Hi @Lulm1992 ,
The master list includes unique control IDs, is it? So, the approach would be:
1. Get items of the master list
2. Initialize two array variables.
3. Apply to each Master list item.
4. Within apply to each control, Get items of Matrix list.
5. Apply to each 2: Matrix item
6. Apply to each 3: Controlactivity value
7. Condition: items('Apply_to_each_3')?['value'] equals to items('Apply_to_each')?['ControlID'], true branch append to variable1:
{
"ControlID": items('Apply_to_each_3')?['Value'],
"RiskNr":items('Apply_to_each_2')?['Risik-No.']
}
false branch leaves blank.
Now the flow has generated an array with two columns, ControlID and RiskNr, so next step is updating this variable with unique control IDs.
8. Out of and underneath Apply to each 2 Control, Filter array on variable1, criteria is item()?['ControlID'] equals to items('Apply_to_each')?['Control ID']
9. "Select" from Filter array, map RiskNr to item()?['RiskNr']
10. Append to variable2
{
"Control ID": items('Apply_to_each')?['Control ID'],
"RiskNr":body('Select')
}
This is the complex array with unique Control IDs and corresponding RiskNr values.
Best regards,