cancel
Showing results for 
Search instead for 
Did you mean: 

How to check list of string present Another Column

Rahul
New Contributor III

Hi,

I have one requirement in this there is one API return list of values comma separated and Another column coming from Snowflake and I need to compare and generate a flag
Note : order of strings are not fixed
Example Column1: [‘STRING1’,‘STRING2’,‘STRING3’,‘STRING4’]

Column2: [‘STRING1’,‘STRING2’,‘STRING3’,‘STRING4’]

5 REPLIES 5

Aleksandar_A
Contributor III

Hello @Rahul,

You can compare the two list by first merging them using the Join Snap. Then, using the following expression in a Mapper Snap to compare the lists:

$api_list.length == $snowflake_list.length ? ($api_list.filter(x => $snowflake_list.indexOf(x) != -1).length == $api_list.length) : false

Here is a sample pipeline:
–sl-comm-compare-lists_2023_07_08.slp (6.6 KB)

Let me know if this is of any help. 🙂

Regards,
Aleksandar.

@Aleksandar_A  - Can you please share the sample pipeline as I am getting Page not found error

Hello @Imran ,

Please find the sample pipeline attached.

 

Thank you @Aleksandar_A 

Also, Is there a way to easily show what key values do not match between two JSON objects?