0

I've got a list with ~4500 Elements.

With Select I took the output of the Get Elements. enter image description here

Now I parsed the Select-output with the Parse JSON enter image description here

Now I want to loop through the output and put Name, Email and Ressort for each entry together into a string variable formatted as HTML. enter image description here The HTML should then be put in an email (for testing) and send to me. enter image description here

Now here's my problem:

When adding a condition, that only entries with Array_Pilotteilnehmer is equal false and put the Compose String in the Yes part, it generates a Apply to Each loop within the first loop. enter image description here

Now it would loop 4500 * 4500 times my list which should be really slow. I want to avoid looping the SharePoint element itself because it's much slower than working with variables/JSON.

How can I solve this/make it better?

2 Answers 2

1

To avoid the 2nd [Apply to each] action, we can use [Current item] and its properties in expressions like items('Apply_to_each')?['ID']. You may not need [Parse JSON] action here to retrieve the properties from [Select] action's output. See the screenshot below.

enter image description here

1
  • Works like a charm! Too bad we have to use expressions to access the items from Select but this can be made easier when they are put into variables for later use.
    – Der_Fab
    Mar 4, 2021 at 9:01
0

Per my knowledge, if you have select the required elements, I will say directly use the create a html table action. No need to add the condition to get the needed records. Using Get Items action, you can set a query to filter all the entries and get the ones you want. Then use the select action to choose needed columns. And finally use the action create a html table.

An example here:https://www.c-sharpcorner.com/article/how-to-create-and-format-html-table-using-microsoft-flow-and-sharepoint-online/

Filter and how to use get items:https://tahoeninjas.blog/2019/07/03/using-the-sharepoint-getitems-action-in-flow/

1
  • My problem is not the condition of Pilotteilnehmer , I can set that in the Get Elements as well. Even if I remove that condition it generates a double Apply to Each block and I can't get rid of it. I tried using the Array as Loop and get the values via variables('arUserliste').Array_Email but this produces only errors. Atm I see no way to loop through the array and extract every value per entry. :(
    – Der_Fab
    Mar 3, 2021 at 9:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.