combine two Activity result intoFor eachActivty

Rohit Kulkarni 711 Reputation points
2025-01-15T10:05:54.8366667+00:00

Hello Team,

I am selecting the value from 2 activity(Filter and Lookup) and need to combine and need to display in forach Activity.

@activity('Filter1').output.Value

activity('LookfileList').output.value

Regards

Rohit

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

1 answer

Sort by: Most helpful
  1. Nandan Hegde 34,096 Reputation points MVP
    2025-01-16T12:14:47.97+00:00

    So to combine the 2 Activity outputs and create a single array,

    1. use Union function ( assuming you need only unique records in final output as union function removes duplicates)
    @union(activity('Filter1').output.Value,activity('LookfileList').output.value)
    
    1. You can use combination of set variable activity, foreach activity and append variable activity as below :

    a) create a array variable say Test

    b) Assign Test variable the value :

    activity('Filter1').output.Value
    

    c) Then use foreach activity with iterations as

    activity('LookfileList').output.value
    

    d) then within the foreach, use append variable where in you append item() {meaning current iteration value} to the Test variable

    This would ensure Test variable contains all values from both the output

    1. you can also use combination of Join, Concat and JSON function

    by JOIN , you can split the array and then via concat you can merge them


Your answer

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