Error/Issue:
However when I triggered the pipeline for testing, got below an error
Wait.. we want output of lookup activity to be provided as input to For Each so that we can iterate through it.
Why it happened
The function 'length' expects its parameter to be an array or a string. The provided value is of type 'Object'.
It was ForEach activity which gave us the error, and as the error says Object was given as input to it
Wait.. we want output of lookup activity to be provided as input to For Each so that we can iterate through it.
But why it's not allowing/accepting it?
How ForEach Loop works in Azure Data Factory
It is one of the control flow activity which can be used in a scenario where you have to iterate through some collection, list, array etc
And you perform or carry out same action/task for each iteration by using some value from the current item.
In ForEach whatever input (array/list/collection) you provide to it, is referenced using term called as items and the records in it as item.
Thus it expects its input parameter to be an array or a string.
And what I had provided - @activity('ConfigLookup').output
Let's see what does @activity('ConfigLookup').output contains
Output is a JSON Object having result of the activity and all the metadata about the activity whereas Value is a JSON array inside Output having actual result of the lookup activity.
What to do
Firstly make a note, even validated pipeline can give you surprises 😏.
So, over here correct input to be provided to ForEach is
@activity('ConfigLookup').output.value
That's it... pipeline happily executed then after.
Related Post
- Required property 'content' expects a value but got null. Path ''.'
- Check your request parameters to make sure the Path “” exists on your file system