question

ewinkiser avatar image
0 Votes"
ewinkiser asked ·

Issue using Contains() in ADF Pipeline? Please help....

Hello again,
@nasreen-akter @MartinJaffer-MSFT @HimanshuSinha-MSFT
I am using a @Contains()

@contains(item().code,variables('NoPension'))

In an IF Condition in my Pipeline

Variables('NoPension') is an array of values and I need to see if the job code (code) is in this array of values (job codes). If NOT, then I want it to fall under True. I haven't used variable arrays before.

I am getting the following error; I have worked on this for several hours and not sure how to set the expression to do this.
Thanks!
Mike Kiser

76325-image.png



azure-data-factory
image.png (42.4 KiB)
· 2
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@ewinkiser did switching the order like @nasreen-akter suggested help?

My understanding is that the collection of stuff you want to search inside comes first, and the thing you want to match comes second.

0 Votes 0 ·

@ewinkiser if you found your own solution, please share it here with the community.

0 Votes 0 ·
NandanHegde-7720 avatar image
0 Votes"
NandanHegde-7720 answered ·

Hey @ewinkiser ,
Based on the error message it is clear that you cannot compare different data type variables.
So one way would be to use a for loop with the array variable as the input and for each iteration check whether the string value is matching to any value in iteration and set a flag variable in case if it matches.

Since in the code I see item.code it means that you are already using for loop and u cannot call for loop within for loop.
So you need to have a pipeline created for the comparison and call that pipeline within the for loop

·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

nasreen-akter avatar image
2 Votes"
nasreen-akter answered ·

Hi @ewinkiser,

I think, it would be vise versa like
@contains(variables('NoPension'), item().code)
not
@contains(item().code,variables('NoPension'))

:)

· 1 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

That makes sense to me. Looks like the order was backwards.

0 Votes 0 ·