I have seen that nested condition in ADF ‘OR’ condition works. But I created an ‘activity’ of an ‘if’ condition which looks like the below:
@or(
and(true, false),
true
)
But it shows an error that it can not compare the string with the boolean value. Does anyone know what is wrong here?
0
The above expression @or(and(true, false),true)
would work if the inner values resulted into correct Boolean values.
But it shows an error that it can not compare the string with the boolean value
If you gave a static string value in the expression, it would show the error in the dynamic editor itself saying both types were not supported in that particular function.
If your inner values are dynamic expressions which might result string values, then it will show the same error at the pipeline run. For sample, I have created a string variable var2
and given a value "true"
. I have used this variable in the expression like @or(and(false,true),variables('var2'))
and assigning this expression to a Boolean type of variable using another set variable activity.
Now, you can see the same kind of error.
To avoid this kind of errors, break down your total expression using Boolean variables set variable activities and see where you are getting the string values and check in which inner expression you are getting the error by debugging them multiple times. After resolving the error, you can combine the correct expression and use it in if activity to get your expected results.
4