Forum Discussion

arvindnsn's avatar
arvindnsn
Contributor
12 months ago
Solved

How to find if the entity exists in an array or not

Hello,    I have a scenario where i use the Gate Snap and the output of the snap would be a empty array or list of entities in the array as shown below. If the array is empty, it would give output ...
  • Aleksandar_A's avatar
    12 months ago

    Hello arvindnsn,

    You can filter the array that comes out from the Gate Snap using the following expression:

    $input0.filter(x => x.hasPath("Name")).length > 0

    Based on the result of this, if no element has Name field it will return false, otherwise it will return true.

    Attached below is a sample pipeline that you can review.

    Please let me know if this helps you.

    Regards,

    Aleksandar.