pass variables inside foreach loop in parent pipeline to execute child pipeline in adf

Sukanya Cu 21 Reputation points
2022-04-26T02:09:18.517+00:00

A parent pipeline has foreach loop having activities to capture variables and execute pipeline(calls databricks notebook). How can I get the variable values passed to a excute pipeline.
196303-image.png

Activities inside foreach loop is in below picture
196357-image.png

Child pipeline in execute pipeline1 is given below and I have added a parametrs in child pipeline which has the same name as variable name passing from foreach loop. But its unable to gte the variable value passed. I also tried (@variables('start_date), but not working. Please help and let me know what is missing here.
196367-image.png

I have refered the methods mentioned in link :https://learn.microsoft.com/en-us/answers/questions/175485/passing-parameters-in-the-execute-pipeline-activit.html
@HimanshuSinha-msft I have followed your steps, but could you pls help where is it missing

Thanks in advance

Azure Databricks
Azure Databricks
An Apache Spark-based analytics platform optimized for Azure.
2,258 questions
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
10,960 questions
0 comments No comments
{count} votes

Accepted answer
  1. MartinJaffer-MSFT 26,106 Reputation points
    2022-04-26T16:44:15.407+00:00

    Hello @Sukanya Cu ,
    Thanks for the question and using MS Q&A platform.

    As we understand the ask here is how to pass variables from a parent pipeline to a child pipeline via the Execute Pipeline activity .

    You are halfway there! Variables and parameters are not passed automatically from parent to child pipelines, you need to specify them in the execute pipeline activity like shown below. Connecting the Set Variable to Execute pipeline is not mandatory, but helps ensure the variable is set appropriately before trying to pass it (otherwise might not be right value!)

    196628-image.png

    There is one more thing you should be aware of, since you are using Set Variable in a ForEach loop. Activities in one loop can overwrite the values set to variable in another loop. Therefore it would be safer to move the logic from the Set Variable activity to directly inside the Execute pipeline activity.

    196681-image.png

    Please do let me if you have any queries.

    Thanks
    Martin


    • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
      • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.