Krishna Murthy
Krishna Murthy

Reputation: 65

How to implement if else and else if in ADF dynamic expression

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.

Upvotes: 2

Views: 31396

Answers (1)

wBob
wBob

Reputation: 14399

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'))

Upvotes: 8

Related Questions