Union only if


I have a pipeline where I need to send two sets of data streams union-ed

  1. a one record stream with static values (not a header but kind of acts like a heads-up column for the remaining records)
  2. a dynamic stream where the data is read from a data source.

However, I need to union them only if Stream #2 has data or otherwise send no data. I tried union and filter snap on snap.in.totalcount > 1 and it works fine when Stream #2 has no data but when Stream #2 has data it only sends data from Stream #2, as totalcount is calculated per row.

Any ideas?


Hi @rajesh_mangipudi,

You can use the Gate snap, Filter and JSON Splitter to achieve what you need. I already did this for you in the following pipeline, so you can easily implement the solution into your pipeline:

Union_Condition_2021_09_07.slp (6.5 KB)


Thanks @bojanvelevski. I have implemented a similar thing as a work around, using the JOIN snap. But I was wondering if there was a more straightforward way.