{tocify} $title={Table of Contents}
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.
If you have questions or suggestions, feel free to do in comments section below !!!
Do share if you find this helpful .......
Knowledge Sharing is Caring !!!!!!
Learn More about some more Azure Data Factory errors
- Cannot find the object "xxx" because it does not exist or you do not have permissions.
- The function 'length' expects its parameter to be an array or a string. The provided value is of type 'Object'.
- ErrorCode=UserErrorInvalidColumnMappingColumnCountMismatch,Message=The column count in column mappings is more than the count in source/sink table.
- ErrorCode=UserErrorInvalidColumnMappingColumnNotFound,Column 'xxx' specified in column mapping cannot be found in source data.
- The path 'xxx' specified in the add operation already exists. Please specify a new path
- Cannot create Sql Source. Error: The value of the property 'Value' is invalid for the stored procedure parameter 'XXX'
- Cannot connect to SQL Database:'XXX' . Verify that the instance name is correct
- Cannot open server 'xxx' requested by the login. Client with IP address 'x.x.x.x' is not allowed to access the server
- Operation on target Copy data failed: Failure happened on 'Source' side
I was stuck for over 24 hours on this portion. I tried researching everything I could and still couldnt get to the results. I can't thank you enough for your help. Because of your amazing post, my work became a breeze.
ReplyDeleteThank you so much for sharing this info. I was struck was nearly 1 hr and this saved me. thank you so much
ReplyDeleteThank you so much. My problem get fixed.
ReplyDeletei am still having issues, i am trying to read following columns vie lookup and wanted to pass this to foreach "ID
ReplyDeleteTable_Name
Source_Table_DB
Source_Table
Taget_Table_DB
Target_Table
Source_Query
Frequency.
is this possible to pass multiple columns to foreach? as i have previously done with 1 column successfully.