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

Mike Kiser 1,531 Reputation points
2021-03-10T15:47:16.847+00:00

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
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
9,542 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Nasreen Akter 10,746 Reputation points
    2021-03-10T17:47:23.45+00:00

    Hi @Mike Kiser ,

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

    :)

    2 people found this answer helpful.

  2. Nandan Hegde 29,886 Reputation points MVP
    2021-03-10T17:12:35.857+00:00

    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