@Michel_Morelli you may want to give the following solution a shot.
The IF node uses the following expression (explained below) to extract all labels from the input: {{ $json.data.map(element => element.label) }}
$json.data refers to the data array. .map goes through each element ({ label: "abcd" }) in the array and transforms it using the callback function. element => element.label function returns value of label property of an element.
Next we need to configure the IF node to work with expression’s output properly. The expression returns an array of string and we want to know if this array contains specific value.
I must admit that the first solution from @mohamed3nan might be more obvious.
@mohamed3nan , I am not criticising your solutions, they are completely legit and straightforward. In fact, a couple of days ago I myself would go for Code node. Full controll, all-in-one, you know. Just started digging into peculiarities of data transformation and core n8n nodes. n8n is fabulous.
Back to the Code node - I assume Code nodes execution is more resource-costly than expressions, so I am trying to avoid it wherever the same result can be achieved with less “heavy” nodes.
@Michel_Morelli , pick the solution you think would be easier for you to maintain and build on.