admin管理员组

文章数量:1125710

I am using an adf pipeline which has an if activity (inside which there is a copy data activity) how do i pass status and endtime of the copydata activity to a notebook outside if condition as base parameter

I have tried writing @activity('activity_name').output.executionDetails[0].status in the base parameters but it said cannot find property output. When I put 2 variables inside if condition and i also kept pipeline variables with the same name and in base parameters I put @variables.status it sent in an empty value

I am using an adf pipeline which has an if activity (inside which there is a copy data activity) how do i pass status and endtime of the copydata activity to a notebook outside if condition as base parameter

I have tried writing @activity('activity_name').output.executionDetails[0].status in the base parameters but it said cannot find property output. When I put 2 variables inside if condition and i also kept pipeline variables with the same name and in base parameters I put @variables.status it sent in an empty value

Share Improve this question edited Jan 9 at 5:54 Rakesh Govindula 11k1 gold badge4 silver badges17 bronze badges Recognized by Microsoft Azure Collective asked Jan 9 at 3:20 reyareya 1 New contributor reya is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct. 3
  • are you getting the above error on failure of the copy activity? – Rakesh Govindula Commented Jan 9 at 3:23
  • @RakeshGovindula nope the activity is running successfully, but i'm not able to capture status and end_time – reya Commented Jan 9 at 4:15
  • I have posted the answer with reasons for the above error. Please check it and let me know. – Rakesh Govindula Commented Jan 9 at 6:30
Add a comment  | 

1 Answer 1

Reset to default 0

t said cannot find property output

The reason for this in this scenario is you are executing the set variable activity outside the if activity. When, the if condition is false, it won't execute the copy activity inside the True activities of if activity. So, your expression involving the same copy activity will give the above error because it won't find the executed copy activity.

it sent in an empty value

Coming to this result, in this scenario, even though it stored the status value in the variable, when the True activities inside If activity itself were not executed, the default value for the variable which is empty string '' will be passed outside the If activity. You can see I got same result upon replicating your scenario. While creating the set variable after copy activity, make sure you create it after the completion of the copy activity. It's the same for the End time of the copy activity as well.

Your pipeline flow is correct when the If activity executed the copy activity. But when it doesn't, it will send the Empty string to the notebook parameters.

In the initialization of variables, set the copy activity status variable default value as null.

You can create another variable if_fail and set its value to a string False activities inside the False activities of If activity.

After the If activity, you can get the Final status which will have the values Succeeded, Failed or False activities using below expression.

@if(equals(variables('status'),'null'),variables('if_fail'),variables('status'))

If copy activity executed, this will hold either Succeeded or Failed values based upon the copy activity execution. If it's not executed, this will hold the value False activities value.

You can send this variable to your notebook and based on this value you can go ahead with your operations as per your requirement.

本文标签: