Quantcast
Channel: TechFindings...by Maheshkumar Tiwari
Viewing all articles
Browse latest Browse all 105

The function 'length' expects its parameter to be an array or a string. The provided value is of type 'Object'.

$
0
0


Error/Issue:


For the last post,  Getting started with ADF - Loading data in SQL Tables from multiple parquet files dynamically , I created a pipeline and clicked on  validate and No errors were found.


pipeline validated



However when I triggered the pipeline for testing, got below an error

The function 'length' expects its parameter to be an array or a string. The provided value is of type 'Object'.


                       


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

incorrect input to for each loop

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 of lookup activity



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.




Viewing all articles
Browse latest Browse all 105

Trending Articles