Forum Discussion

darshthakkar's avatar
darshthakkar
Valued Contributor
4 years ago
Solved

Understanding router snap's functionality

Hi Team,

I wanted to understand more about Router snap as I was stuck routing data today. Let’s assume I’m reading a flat file with 100 records and the file has 3 columns, ID (can have duplicates), Name, and Phone Number.

I want to route the data where ID = 130 and rest others, how do I achieve this?
As I want both the data for different transformations, can’t use a filter snap and that’s where router helps.

The first condition would look like $ID == 130, what would the other condition look like to consider all the remaining records.

I don’t want to write $ID !=130; reason being, my actual use case has a lot of conditions, so I want either 100 or others. I did try with true and false but it didn’t seem to work for me.

In addition to this, I wanted to learn whether we can write a nested condition in router, e.g.
$Name == null || $PhoneNumber== null || $Name == null && $PhoneNumber== null
Would the above work as expected?

Expectation is:

Route all records whose Name is Null OR Phone Number is Null OR both Name & Phone Number is Null

Appreciate your help and time on this one.

Regards,
Darsh