cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JGotta
Regular Visitor

Apply to each sets variables to null

Hi all,

 

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?

 

Thanks!

4 REPLIES 4
fchopo
Super User
Super User

Hi @JGotta 

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!
Ferran

Did I answer your question? Please consider to mark my post as a solution to help others.
Proud to be a Flownaut!
JGotta
Regular Visitor

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.

 

Thanks!

fchopo
Super User
Super User

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.

Regards,
Ferran

Did I answer your question? Please consider to mark my post as a solution to help others.
Proud to be a Flownaut!
JGotta
Regular Visitor

Yes that make sense. The problem I am having is that I do not know how to apply the numbered iteration and only run the model for that given variable.

Helpful resources

Announcements
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

PA Survey Carousel Image.png

We want to hear from you!

If you are a small business ISV/Reseller, share your thoughts with our research team.

Users online (1,147)