I fail using a select statement within a foreach loop of a flow.
The foreach loop is meant to iterate through a list of items retrieved from a SharePoint list. The get-items-operation is already filtered by OData and should return either an empty list or only one item. Nevertheless it is a list and has to be iterated within a foreach loop.
Within the loop I then want to extract a certain field from the list. The field is a multiple choice field.
The data which is available within the loop reads:
[
{
"@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
"Id": 0,
"Value": "Brand- & Evak.helfer"
},
{
"@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
"Id": 1,
"Value": "Ersthelfer"
},
{
"@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
"Id": 2,
"Value": "SiB"
}
]
I want to use the content to update a field in a different SP list. As the identity of the ID and the Value is different there, I have to remove the ID. Optimal outcome should look like:
[
{
"Value": "Brand- & Evak.helfer"
},
{
"Value": "Ersthelfer"
},
{
"Value": "SiB"
}
]
I'm unsure, how to fill the boxes in the select element.
I filled the "from"-box with:
items('name_of_comprising_loop')?['name_of_multiple_choice_field']
This seems to be correct, as I can see the data (see first sample) in the input section of the debug view. I then wrote into the first "key"-box:
Value
This seems to make sense as well, considering the output below. And into the first "value"-box:
@items('name_of_comprising_loop')?['name_of_multiple_choice_field/Value']
The outcome unfortunately is:
[
{
"Value": null
},
{
"Value": null
},
{
"Value": null
}
]
I think I really don't understand, how the select operation works.
Update I'm apparently too stupid to understand, why it can't be done with a select operation.
Citing the MS documentation:
Use the Data Operation – Select action to transform the shape of objects in an array. For example, you can add, remove, or rename elements in each object in an array.
Then why is it impossible to transform
[
{
"@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
"Id": 0,
"Value": "Brand- & Evak.helfer"
},
{
"@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
"Id": 1,
"Value": "Ersthelfer"
},
{
"@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
"Id": 2,
"Value": "SiB"
}
]
into
[
{
"Value": "Brand- & Evak.helfer"
},
{
"Value": "Ersthelfer"
},
{
"Value": "SiB"
}
]
with the select operation?