Hello, thank you for asking here:
To select only the first value of a field within the “Apply To Each” in Power Automate and append it to a string variable and use this variable in query to filter results, you can use the Select action. The Select action is used to select a subset of properties from an object or an array of objects. You can use this action to select only the first item from an array.
Here’s how you can do it:
Add the Select action after the Apply to each action.
In the From field, select the output of the Apply to each action.
In the Map field, enter the following expression: first(body('Apply_to_each'))['FieldName']. Replace FieldName with the name of the field you want to select.
In the Outputs field, enter the name of a variable that will store the selected value.
You can then use this variable in your query to filter results.
I hope this helps!