I am having a bit of trouble figuring out this scenario for a fix if anyone could help me. I am using survey123 for inspection reports for backflow devices. so my main layer has constants that i want to reference in the email (size make model etc) I have no problem with those, but my inspection table is a repeat. I am trying to find a way to only email the last repeat section. power automate inserts the apply to each function which sends multiple emails for each line in the repeat table
(This is just some info to move you in the right direction. I haven't used MS Flow and my workflows are normally the opposite of what you're doing)
"Multiple emails for each line in the repeat table"
This is resolved by using an array aggregator to combine each bundle into one.
Sorry I don't have a screenshot to show you how it would be configured in Integromat. I do the opposite with an iterator, so that I can add each record as a row to a spreadsheet (which would cause an email to go out for each record, which is what you're seeing). On the off chance it helps to, here's a screenshot of how my iterator is set up by pointing at the repeat table:
Once you get all of your repeat records aggregated to a single bundle, it'll end up sending out a single email instead.
"Only email the last repeat section"
I'm not sure if this means that you only want to email the aggregated repeat table (meaning every record in the repeat combined into a single bundle) or if you're saying that you want to find the very last record in the repeat and only email that one.
If you're after the latter....you can ignore the first part of my post since you won't need to aggregate all those records into one. You would need to find the max() index of the record in your repeat and then set up MS flow to only email the record for that index position. I'm not sure how this looks in MS Flow, but in Integromat you could insert that index position here:
(Sorry if this post isn't much help - I spent a lot of time trying to figure out how to work with the repeats when I first set up integromat and I would have saved a lot of time if I'd know iterators and aggregators even existed.)
Hi Daniel,
Use the apply to each function to "Append to a variable" the values you want to include in the email, put that loop before the rest of your processing on the main layer.
Your flow would look like
Survey123
Initialize Variable
Apply to Each { Append to Variable }
Send Email { Main Layer Constants }