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.com)
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.
Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.
Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.
The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.