Passing Array Parameter in Look Activity

Rohit Kulkarni 441 Reputation points
2021-03-11T19:57:20.71+00:00

Hello Team,

I want to Pass the array parameter in lookup activity.

76951-image.png

I am Passing the parameter :

AND LEFT(t.TABLE_NAME,CHARINDEX('$',t.TABLE_NAME) - 1) IN [@{pipeline().parameters.Companies}]

After running the query i am getting error

76838-image.png

Please advise .

Thanks
RK

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
{count} votes

Answer accepted by question author
  1. Nandan Hegde 36,716 Reputation points MVP Volunteer Moderator
    2021-03-12T04:11:55.853+00:00

    Hey Rohit,
    Based on above things I guess your requirement is you want to get the result from Information_schema:
    So please make the below changes :
    Update the Parameter type to String and its value as :
    'Group','ABC'
    without any parenthesis

    And also update lookup activity as below:
    select * from from INFORMATION_SCHEMA.TABLES t

    where LEFT(t.TABLE_NAME,CHARINDEX('$',t.TABLE_NAME) - 1) IN (@{pipeline().parameters.Array})

    Hope that should solve


8 additional answers

Sort by: Most helpful
  1. Rohit Kulkarni 441 Reputation points
    2021-03-12T13:22:41.997+00:00

    Sorry for repeating Please don't remove the where clause statment.I am sending you the whole script once again :

    @markus.bohland@hotmail.de ('select distinct
    LEFT(t.TABLE_NAME,CHARINDEX(','''$''',',t.TABLE_NAME) - 1) AS CompanyName
    from INFORMATION_SCHEMA.TABLES t
    where t.TABLE_TYPE ="BASE TABLE"
    AND t.TABLE_NAME like "%$%"
    AND LEFT(t.TABLE_NAME,CHARINDEX('$',t.TABLE_NAME) - 1) <> ''
    AND LEFT(t.TABLE_NAME,CHARINDEX(','''$''',',t.TABLE_NAME) - 1) IN (', replace(replace(replace(replace(string(pipeline().parameters.Companies),'[',''),']',''),'\',''),'"','''') )

    I am getting error

    77210-image.png


  2. Rohit Kulkarni 441 Reputation points
    2021-03-12T13:36:39.827+00:00

    The query is working fine Now the out put is blank.Please refer the screenshot below:

    Passing paramter in Pipeline :

    77252-image.png

    I have Passed the value in parameter :

    77261-image.png

    The output is blank

    77130-image.png


  3. Rohit Kulkarni 441 Reputation points
    2021-03-12T14:01:16.21+00:00

    I can't run this pipeline because it starts loading data from 1 environment to other environment. I just wanted to add one parameter in offline mode and test it.

    Is there any other way i can find.

    Thanks

    RK


  4. Rohit Kulkarni 441 Reputation points
    2021-03-12T14:24:10.657+00:00

    Already existing pipeline is there which will transfer the data from raw zone to staging zone.

    When i run the query it is showing blank.If i comment this "AND LEFT(t.TABLE_NAME,CHARINDEX(','''$''',',t.TABLE_NAME) - 1) IN (', replace(replace(replace(replace(string(pipeline().parameters.Companies),'[',''),']',''),'\',''),'"','''') )"

    If i run the previous query

    select DISTINCT LEFT(t.TABLE_NAME,CHARINDEX('$',t.TABLE_NAME) - 1) AS CompanyName
    from INFORMATION_SCHEMA.TABLES t
    where t.TABLE_TYPE = 'BASE TABLE'
    AND t.TABLE_NAME like '%$%'
    AND LEFT(t.TABLE_NAME,CHARINDEX('$',t.TABLE_NAME) - 1) <> ''

    Then the output will be

    77160-image.png


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.