I'm parsing an email message. This message can contain multiple alert messages. I have found a way to split the html_to_text so I have each alert as a separate array element. However, the text I am splitting on is also earlier in the body so I end up not needing the first two array elements. If there is only one alert I need array element 3, if there are three I need elements 3, 4 & 5. Ultimately the array element data will be inserted into a sql server database.
I'm thinking I need to use an Apply To Each action. The problem is I don't know how many elements there will be, just that I need to skip the first two.
Any ideas how to skip the first two? Thanks!
Solved! Go to Solution.
Found it! I need to use skip(variables('Array'),2).
Found it! I need to use skip(variables('Array'),2).
Please find below the logic you need to do to skip first 2 items in the array.
1. Initialize a count variable outside of your array
2. Inside the apply to each
1. Add a compose data operation as below
add(variables('count'),1)
2. Set the count variable to the output of the compose operation
3. Add a condition if count = 3 then do your logic , on the yes branch, this will skip the first 2 items in the array
Hope this works for you!
I'm sure that works but seems much more complex than what I found. Then again, maybe what I found won't work all the time or is even correct?
That worked for me. Is that way bad or wrong? I'm still very new to Power Automate, so could be I'm doing it wrong.
User | Count |
---|---|
91 | |
43 | |
19 | |
18 | |
15 |
User | Count |
---|---|
137 | |
54 | |
42 | |
41 | |
30 |