2

How can I achieve below conditions in ADF dynamic expression:

if variable=a then A
if variable=b then B
else C

I'm able to achieve only true or false condition in IF but here I want to verify multiple conditions. No switch case function available in adf dynamic expression.

wBob
  • 13,710
  • 3
  • 20
  • 37
Krishna Murthy
  • 55
  • 1
  • 2
  • 10

1 Answers1

7

The if function in Azure Data Factory's (ADF) expression language only supports one true or false condition and no switch function but you just have to nest them. Use the equals function for value comparison. Something like this:

@if(equals(variables('varInput'), 'a'), 'Ax', if(equals(variables('varInput'), 'b'), 'Bx', 'C'))
wBob
  • 13,710
  • 3
  • 20
  • 37
  • i am not able to understand above the condition, please help me. i want to check condition based my activity output to setup true or false based if condition.. like if(A==1) or if (B==2) – Developer KE May 10 '23 at 09:38
  • Hi @wBob what you mean by AX and BX is it after matched record , we have to consider its the right value and C is the both condition not matched we can put in C..is it my understanding is correct. kindly help me. – Developer KE May 12 '23 at 10:59