Pass Multiple Value to a For Each in Azure Data Factory - azure-data-factory-2

Can someone let me know if its possible to pass a parameter and an activity to a For Each in Azure Data Factory.
From the image I want to pass the parmater 'relativeURLs' into a For Each.
I would then like to do a For Each on the Lookup activity 'CompanyId Lookup
Is that possible?

I am not very confident if I get the ask correctly .
I would then like to do a For Each on the Lookup activity 'CompanyId
Lookup Is that possible?
This should go in the Foreach
#activity('your lookup activity name ').output.value
Since the relative url is a parameter , you can reference that inside the FE loop

Here is the procedure to Pass Multiple Value to a For Each in Azure Data Factory.
create Linked service and dataset.
Create parameter of relativeURL with respective values
Read the data by the Lookup activity.
#range(0,length(pipeline().parameters.relativeURL))
using two values inside Foreach using their indexes.
In ForEach, check the Sequential
Create variables for different values.
The value of the set variable from the lookup activity.
#string(activity('Lookup1').output.value[0].data[item()])
Value for this set variable from the pipeline parameters of the relativeURL
#pipeline().parameters.relativeURL[item()]

Related

Adding a dynamic column in copy activity of azure data factory

I am using Data flow in my Azure Data factory pipeline in order to copy data from one cosmos db collection to another cosmos db collection. I am using cosmos SQL Api as the source and sink datasets.
Problem is when copying the documents from one collection to other,I would like to add an additional column whose value will be same as one of the existing key in json. I am trying with Additional column thing in Source settings but i am not able to figure out how can I add an existing column value in there. anyone with any help on this_
In case of copy activity, you can assign the existing column value to new column under Additional column by specifying value as $$COLUMN and add the column name to be assigned.
If you are adding new column in data flow, you can achieve this using derived column

Azure Data Factory Lookup and For Each

I have a Data Factory Pipeline that I want to have iterate through the rows of a SQL Lookup activity. I have narrowed the query down to three columns and 500 rows.
I understand that to reference a value in the table I use:
#{activity('lookupActivity').output.value[row#].colname}
However, the for each needs to have something to iterate over. My first guess is to set some array variable to the rows of the returned sql query. So what do I set that variable to?
#{activity('lookupActivity').output.value?
Lastly, it looks like almost all data is represented as a json in ADF, is this true? And how could I view the output of this look up as a json so I can understand what my dynamic content needs to look like?
You're right that everything (nearly) is JSON. (Exception: Azure Data Factory v2: Activity execute pipeline output
So you can put your #activity('lookupActivity').output.value which is an array into the foreach activity on the settings tab, like this
Then inside your foreach loop, you reference the current value of one of the columns as #item().colname.
You can use the output value to for each activity and go through one at a time. You can do sequential or parallel depending on your needs.

Read for-each-loop container variable in OLEDB source variable windows

I make one table named QueryTable that store 4 SQL queries each have different meta data
I want to store these four queries result in Excel sheet
First I have taken executable SQL task and configured the connection and Result Set as a Full Result Set, Query statement.
After that open Result Set tab and create Query_variable as a object type.
2) Drag the For-Each_loop container and set Foreach ADO Enumerator in collection part and assign Query_variable
In variable mapping part create new variable as string type to store four queries. Result.
3) Finally add I one data flow task add OLEDB source configure with Same variable (That I have given in for each loop container).
Rightnow it is showing default value what i have given in User::Variable
I can iterate same No of column (Meta-data) queries and store in excel destination
But the Problem is when variable goes to next query that holds lesser or greater no of column.Here package fail cant handle different meta data table
Please assist me ,Can we iterate different meta data queries same time with proper output?
I Hope I have Explain the Problem what i facing exactly
Set the default value of User::Variable to one of the queries, so that BIDS can validate it at design time.
You can also try setting "DelayValidation" to true, but that might not be enough in this case.
Set the delay validation to true for both the data flow and the for each loop container.

How to retrieve value in ObjecStore using MEL

I need to retrieve object store value in DataWeaveComponent. Some of the suggestions given were to store the value in flowvariable and use it. Well it does not work in my case, Because I am transforming a collection of 1000 records in DataWeave. For each record, I need to fetch the value from object store and store it to a field. Any ideas would be highly appreciated.
You can create a flow that does what you want and then use the lookup function to execute it from DataWeave.
There are multiple ways you can achieve this
1.Storing the entire value from object store to a flowVars and access it,Dont create multiple variable foe each time
2.Create lookup in data weave then in the lookup flow retrive the object store content.But you will invoke object store every single time.
My suggestion is to fetch the content of Obj store and add it to flowVars.
Please let me know in comment if need further clarification.

Read column values to variable in SSIS using for each loop

I want to read the resultset of a table using the following stmt:
Select col1 as A,col2 as B from tablename;
Then, I want to read each row of the result set into local variables of the SSIS package and for each row I have to pass the values to the script task.
I want to use foreach loop in SSIS. I took Foreach Item Enumerator.
The question: How to read the values into the variable using the For each Item enumerator and how can i iterator can i use select count(*) from table; pass that value to a variable and asssign the count value in the foreach loop.
I'm stuck at how to assign the count value and read columns to variables. Can anyone help with these?
Thanks in advance.
I'm not exactly sure what it is that you're trying to do, but it would seem that you're trying to process data in your control flow. The foreach iterator is not made for processing data sets, it's made for iterating over multiple data sets and doing something to each of them, usually passing them to a data flow.
You might find it more useful to create a data flow. Start with a data source component that gets the data that you want and then pass the data to a Script Component to do the processing.