3

I would like to create ForEach loop and need advice:

  1. I have "Fetch" Lookup with "Select CustomerName, Country From Customers".
  2. It return rows like "Tesla, USA" and "Nissan, Japan". There are total 10 rows.
  3. I would like to run ForEach loop for 10 times and use CustomerName and Country value in pipeline.
  4. ForEach settings values are current set: @activity('Fetch').output (something wrong here?)
  5. I would like to create new Lookup inside ForEach. I would like in Lookup query "SELECT * FROM Table WHERE CustomerName = 'CustomerName' and Country = 'CountryName'"

enter image description here

Error of ForEach:

 The function 'length' expects its parameter to be an array or a string. The provided value is of type 'Object'. 
1
  • Can you share the JSON definition of your pipeline? Commented Nov 4, 2021 at 16:06

1 Answer 1

3

The Items property of the For Each activity should look something like this:

@activity('Fetch').output.value 

You can then reference columns from your Lookup within the For Each activity using the item() syntax, eg @item().CustomerName. Remember, expressions in Azure Data Factory (ADF) start with the @ symbol but you don't have to repeat it in the string.

enter image description here

Sign up to request clarification or add additional context in comments.

2 Comments

I modiefied ForEach Expression as "@activity('Fetch').output.value". Tried Sequential disabled and enabled. Error is given: The expression 'length(activity('Fetch').output.value)' cannot be evaluated because property 'value' doesn't exist, available properties are 'firstRow, effectiveIntegrationRuntime, billingReference, durationInQueue'.
Disable the first row property in lookup activity

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.