Azure Data Factory | Evaluate more than 2 values in logical operator

 


Super quick solution if you ever encountered/stuck with this scenario in Azure Data Factory 

Let's say there is an if condition activity and you need to evaluate the output value from a previous activity (could be metadata or could be inside for each loop ).  The values to be evaluated against are more than two in number. 
The programming equivalent of it would 
        when variable1 not in (Value 1, Value 2, Value 3, Value 4)

If you have some experience working in the azure data factory, you would like to use the following expression 


@and(not(contains(item().name, 'Value1')),

not(contains(item().name, 'Value2')),

not(contains(item().name, 'Value3')),

not(contains(item().name, 'Value4')),

not(contains(item().name, 'Value5')),

not(contains(item().name, 'Value6')) )

However, this will not work out and you will get an error message. 

Instead, try using a variable. Assign the value to the variable before evaluating and then use this expression 


@not(contains(createArray('Value1', 'Value2', 'Value3','Value4','Value5','Value6'),variables('Variable1')))


This should work. Let me know if you have any questions in the box below. 

Happy Learning !!!!


 



Comments

Popular posts from this blog

Issues Integrating Azure Data Factory with GITHUB | IN spite of admin rights on repository

SQL QUERY NIGHTMARE

Visual Studio Git Error | "terminal prompts disabled"