cancel
Showing results for 
Search instead for 
Did you mean: 

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

TWCMG
New Contributor II

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?

2 REPLIES 2

darshthakkar
Valued Contributor

Hi @TWCMG,

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

image

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.

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’)