Hello,
Am working on building an invoice processing model. While creating different collections, I came across some invoices where there is no line number on the invoice. My model is reading the information on an invoice uploaded on SharePoint and exports the information into a CSV file on SharePoint.
The Invoice line number is one of the primary keys in the table where I am trying to insert the data into, so if it is not available on the invoice, I need to generate it automatically. So, I thought of creating an integer variable and increment it every time the Invoice processing solution would detect a line in the table on the invoice. The variable is incremented successfully. However, when the data is inserted into a CSV file, it keeps the last value of the variable. For example , if there were 4 lines on the invoice , the invoice line number on the invoice gets inserted as 4 for all lines instead of 1,2,3,4.
I did not want to rewrite the whole flow - so in Power Automate, I have created a separate loop to deal with the invoice number issue. That's why in my screenshots, you will see 2 'Create CSV table'.
Am attaching some screenshots to help with the problem description.
Can you please help me ?
Thank you
Shadiya
Hi Shadiya,
I had exactly the same issue in the past with Logic Apps. Setting the degree of parallelism to 1 (For Each action settings) solve the issue.
Good luck.
Hi shadiya,
Is the for each loop setup to run each iteration sequentially, or are they running concurrently as per default behavior?
Concurrent loop iterations and variables don't play nicely in Power Automate/Logic Apps: https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-control-flow-loops#foreach-loop . Setting up the loop to run sequentially might help get predictable variable operations: https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-control-flow-loops#sequential-foreach-loop .
Does this help?
WarrenBelz
770
Most Valuable Professional
stampcoin
494
MS.Ragavendar
399