Grevioos
Grevioos

Reputation: 405

ADF data flow, pass ForEach activity's @item() to sink's settings(?)

In my data flows I have a lot of scenarios where I just upsert data from one database to another(names of tables are the same in both of them). I would like to avoid duplicated operations and just use ADF ForEach for that.

So I have defined pipeline's variable with my table names. Then in ForEach activity, I am using @item() as a parameter for my data flow which is nested inside of it. However, my problem lies here:

enter image description here

My key column is always name of the table + "ID", so I have wanted to do something like concat(@item(), "ID") to make it work. However, this "add dynamic content" doesn't allow to do that.

Is there some way to reference items from ForEach activity in this scenario?

Thank you in advance!

Upvotes: 0

Views: 2964

Answers (1)

Mark Kromer MSFT
Mark Kromer MSFT

Reputation: 3838

  1. Create a parameter in your data flow. Make the data type of the parameter the same data type as the field you'll use for the key column. Let's call it "dynakey" for this sample.

  2. In the pipeline activity, set the parameter "dynakey" for that data flow as the concat expression you have above, as a parameter expression.

  3. In Key Columns, choose "add dynamic content". Set the value for the field to the parameter "dynakey".

Upvotes: 1

Related Questions