Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Operation on target ForEach1 failed: The function 'length' expects its parameter to be an array

Hi, I am using Fabric trial licence. I created a pipeline with Lookup as startting point to retrieve SchemaName and TableName from on prem sql database. It wotks fine and gives me the desired ...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi Anonymous , nilendraFabric BhaveshPatel 

    Thanks for all your suggestions. All point to the same approach.

    I solved the issue as follows.

    In the Query area of the Lookup settings, I first used

    select TABLE_SCHEMA as SchemaName , TABLE_NAME as TableName
    From ecommerce INFORMATION_SCHEMA_TABLES
    where TABLE_TYPE= 'BASIC TABLE'

    This did give me thee schemaname and tablename. But did not have the option to select value array in the For Each Loop.

    I changed the query to

    select s.name as SchemaName,
    t.name as TableName from sys.tables t
    JOIN sys.schemas s on t.schema_Id = s.schema_Id Order by s.name ,t.name

    This also gave me the SchemaName and TableName. And it allowed me to choose Lookuparray in the ForEach loop.

    So by the above in the query solved my issue in the ForEach loop.

    Another thing I observed is

    In the destination screen of the Copy acitity 

    If I put the @item().TableName in the fileName above, it did generate the files but coluld not be previewed in the Lakehouse. And the 

    whas greyed out .txt and could not be changed to csv.
    With the above settings the files got created with .csv extension and could be previewed.
    However the file names included dbo. in the beginning of the file name.

     

    Anonymous . May be you can check with internal documentation for above behaviour.

    With this I have solved my issue. 

    Cheers

    CheenuSing