
Announcements
I have spend the whole day to fix the problem.I am generating pdf report using html and power automate.
now I have faced a problem of looping while I only need a single value:
as I tried to explain on the image below, the column Voucherno and Location are located in the same sharepoint list, I want only a single value of them based on my condition. if i remove them the flow works fine, but I need them.
The moment I try to append a variable, automatically they apply to each is added , that means they become loop.
help me how to get a single value in such cases.
Hi @Sebey ,
I suppose your Voucherno and Location dynamic contents are from the SharePoint “Get items” action. In this scenario, the “Get items” action will return an array value and this is why power automate automatically generates an “Apply to each” outside your “append to string variable” action.
In my test, I have a list with only one item, even in this case, power automate will generate the “Apply to each” action as well. Basically, if your “Get items” action only returns one row, it would be fine even if the flow is adding the “Apply to each” action, because it will only run for once and it will use the single value as expected.
However, if your “Get items” action returns more than one row, you will need to use the filter query in your “Get items” action to make sure this action will only return the single row that will be used in the “Append to string variable” action.
For example:
My list:
Then in my Get items action’s Filter query:
Query Schema:
column_name eq '(the value)'
Flow will only return the row with title value equal to “dd”, it’s one single row which would be fine with the “Apply to each” action.
Or, if you don’t want to do the filter query, then you will need to use the expression to get the specific single item to avoid the “Apply to each” action:
For example: (still using the same list above)
I want to append the “Title” value from my second item:
Expression in "Append to string variable" action :
outputs('Get_items')?['body/value'][1]['Title']
So, please feel free to let me know if you still have question related to my above answer, I would be glad to help further if the situation is different from your side.
Best Regards,
Hen Wang