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

Mike Kiser 1,531 Reputation points

Hello again,
@Nasreen Akter @MartinJaffer-MSFT @HimanshuSinha-msft
I am using a @Contains()


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.
Mike Kiser


Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
7,132 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Nasreen Akter 10,656 Reputation points

    Hi @Mike Kiser ,

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


    2 people found this answer helpful.

  2. Nandan Hegde 22,721 Reputation points

    Hey @Mike Kiser ,
    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

    0 comments No comments