question

AichaBayram-9633 avatar image
0 Votes"
AichaBayram-9633 asked PratikSomaiya commented

ADF - Read a column values through lookup activity

Hello,

I hope you are doing well ?
Working on ADF and using the LookUp activity, I want to read multiple values of a column.

This expression : @activity(‘Lookup1’).output.value[1].col2 reads only a value and @activity(‘Lookup1’).output.value.col2 do not work.


Rgeards,
Aicha Bayram

azure-data-factory
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

PratikSomaiya avatar image
0 Votes"
PratikSomaiya answered PratikSomaiya commented

Hello @AichaBayram-9633

You can read multiple values / output of your Lookup using ForEach activity and use them inside another activity

@activity(‘Lookup1’).output.value[1].col2 will always read only 1 value as you have specified value[1], an index from an array

You also can't use @activity(‘Lookup1’).output.value.col2 as the values in output are in form of an array and you need to mention an index

You can consume multiple values via ForEach activity

· 5
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you for your answer. And while using the Foreach activity, the inside activity must be a Lookup and I call the output with the item function ?

0 Votes 0 ·

@AichaBayram-9633

Lookup should be outside your ForEach and you will pass Lookup activity's output to ForEach activity as below:

205891-image.png



The Expression for your ForEach will be as below:

 @activity('Lookup_metadata').output.value
1 Vote 1 ·
image.png (7.6 KiB)

@PratikSomaiya how can I read the output of the Foreach activity please ?

0 Votes 0 ·

@PratikSomaiya do I have to insert my outputs in a variable beafore calling it in the For each activity ?

0 Votes 0 ·

@AichaBayram-9633

You need to consume the values inside ForEach activity

Also, the output of Lookup activity will directly be consumed by your ForEach expression, you don't need to save it as a variable

0 Votes 0 ·