Designing a pipeline to route depending if there is or is not data in an initial query

Hi,

I am trying to design a pipeline where it initially will pull in a query result set. I am trying to create a route that identifies whether the query result set returned records or did not return records. Any idea on how to design this pipeline?

1 Like

Hi @TWCMG,

Welcome to the community. You can add a “mapper” snap after fetching your query result with the following expression:

After the mapper snap, have a “router” snap with the conditions:

  1. $UpdatedRecords > 0
  2. $UpdatedRecords < 0

NOTE: You can put any name instead of $UpdatedRecords, it could be $xyz / $counts / etc.

2 Likes

I think when you execute a query and you don’t have any results, you will get an empty object on the output, or just the original object if the Execute snap has an input.

In this case, you can check for a specific field that you know that exists in the result set.
Example: $.hasPath(‘timestamp’)

2 Likes