Forum Discussion

Regurr840's avatar
Regurr840
Icon for Microsoft rankMicrosoft
Oct 26, 2024

Nested if statement in the expression builder (dynamic editor)

Hello

I am trying to check activity steps failed and if so, get Target (activity) value, something like this below

@{

"FailedStepAt": "@{if(not(empty(activity('lkp_tables_list').erro.message)), activity('lkp_tables_list')?.erro.target,
if(not(equals(activity('lkp_GetPipelineIDByName').error.message, '')), activity('lkp_GetPipelineIDByName').error.target,
if(not(equals(activity('Export_table_to_NTADLS').error.message, '')), activity('Export_table_to_NTADLS').error.target,
'')))}",
"ErrorMessage": "@{concat(activity('lkp_tables_list')?.error?.message,
activity('lkp_GetPipelineIDByName')?.error?.message,
activity('Export_table_to_NTADLS')?.error?.message

}

But it doesn't work . However, to check the target value if activity fails, used set variable to capture the target value but it supports with one condition  something like ."

"@{if(not(empty(activity('lkp_GetPipelineIDByName').error)), activity('lkp_GetPipelineIDByName').error.target,
   'no err')
   }"
I want to achieve using nested if within dynamic edition

Or within set variable activity

 

Any help would be appreciated

  • alexdarling's avatar
    alexdarling
    Copper Contributor

    Regurr840 Hi, Can't see the activity that may fail, but shouldn't you be using the failure connection not the success? 

Resources