I currently have a model built to examine two pdf attachments (different documents) that arrive via email, I use the predict function to extract the information for the fields in both documents and it pulls all the correct information.
I know look to set the information extracted from those documents to variables by using set variable, the only way to do this is to set the variable within the apply to each action due to the predict action. When I look through the set variables for the first attachment, everything is assigned perfectly with the second attachment fields left blank. The issue is when I flip to the second attachment, everything that was assigned is now null except for the fields that are supposed to be extracted from the second attachment. This messes up my flow as now all the variables that were previously set, are now set to null and are incorrect. How do I set up my flow to not set variables to null that have already been set via the first attachment.
In other words, is there away to set variables using just the fields in the first attachment and then for just the fields in the second attachment, without overwriting what has already been set?
You can initialize a counter variable outside the apply to each, and then use it in every iteration. If iteration number equals 1, do some assignments, while if it's different, do other ones.
Here's a sample on how to get a numbered iteration: Solved: How to get the numbered iteration in an Apply To E... - Power Platform Community (microsoft....
Hope it helps!
Hi Ferran, thanks for the response.
I am unsure what you mean by using a numbered iteration. Is it essentially setting a variable so that it will only be used for a given attachment?
Please elaborate, still a bit confused after reading the sample you provided.
As I understood, you need to know in which iteration you're, so you can manage first attachment and other attachment. So yes, I'm referring to use a numbered iteration and use that variable to handle attachments.
Hope it makes it clear.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!