
Image by Bruno Glätsch from Pixabay
If I didn't have Switch activity in the ADF, this would be my way to create logic with multiple conditions to process files based on a File_Action parameter-flag.
Where each of the IF conditions would have the following expressions to evaluate:
a) @equals(pipeline().parameters.FileAction,'move')
b) @equals(pipeline().parameters.FileAction,'copy')
c) @equals(pipeline().parameters.FileAction,'delete')
And each of IF activity containers would have the following list of sub-tasks:
a) Copy Data; Delete
b) Copy Data
c) Delete
However the new logical control flow for my ADF pipeline may look a bit simpler with only "Get Metadata" and "Switch" activities:
My Switch activity expression would be just set to my pipeline parameter value: @pipeline().parameters.FileAction
and on the next tab, I can define different cases that need to be evaluated:
You can also notice sub-tasks associated with each different case, "move" case has two tasks indeed.
And after executing this ADF pipeline with 'copy' value for FileAction parameter, you can even check how many files got copied.
The code of this ADF pipeline can be found here:
https://github.com/NrgFly/Azure-DataFactory/blob/master/Samples/pipeline/Workflow_Switch_activity_pl.json
Let me know what your thoughts are about this new ADF activity.
0 Comments