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

Apply to each running more and more each time

Hi, so I have created a flow with the aim, after a form has been submitted the flow will scan an excel sheet and if there is already data matching a value then it will only update the row rather than creating a new row and if the data did not exist it will add a new row to the table. I managed to run this successfully on my first try with the row update but I try to test with no previous information in the table the flow failed and I realised I had an incorrect field.

I fixed this and changed the flow to suit more correctly but now the apply to each will run several times adding a new duplicate rows and adding to an existing row if the information is already there.

The duplicate rows will also create if there is no information already present in the table.

 

I am rather new to power automate and it may be something very obvious that I have done to replicate the apply to each as in principle the flow works as intended but the excess data being created will eventually be a problem when  implement the full flow.

Likewise if data is present in the flow the apply to each running several times with one of the runs is correct, where it updates the row rather than adding a row but the other 8 runs do not update and add 8 dublicate rows.

 

Any help will be greatly appreciated and any more information I will try my best and update you.

Thanks

Ben

1 ACCEPTED SOLUTION

Accepted Solutions
v-chengfen-msft
Microsoft
Microsoft

Hi @bengerry77 ,

The cause of this problem is:
1. The data submitted by the form will be compared with all the data in excel
2. For each comparison, update if they are the same, and create a new one if they are different.
This results in the creation of duplicate data

 

Please try to use filter query to filter excel,
If there is such a record, the length of the return value is greater than 0, then update this record
If there is no record, the return value length is equal to 0, then create a new record

Here is a test for your reference:

Here is excel:

vchengfenmsft_4-1670467603622.png

 

Here is flow:

vchengfenmsft_2-1670467465586.png

vchengfenmsft_3-1670467502819.png

Here is result:

 

Add a new row:

vchengfenmsft_5-1670467650257.png

vchengfenmsft_6-1670467675005.png

 

Update a row:

vchengfenmsft_7-1670467741666.png

vchengfenmsft_8-1670467786641.png

 

 

 

Best Regards

Cheng Feng

 

 

 

View solution in original post

3 REPLIES 3
v-chengfen-msft
Microsoft
Microsoft

Hi @bengerry77 ,

The cause of this problem is:
1. The data submitted by the form will be compared with all the data in excel
2. For each comparison, update if they are the same, and create a new one if they are different.
This results in the creation of duplicate data

 

Please try to use filter query to filter excel,
If there is such a record, the length of the return value is greater than 0, then update this record
If there is no record, the return value length is equal to 0, then create a new record

Here is a test for your reference:

Here is excel:

vchengfenmsft_4-1670467603622.png

 

Here is flow:

vchengfenmsft_2-1670467465586.png

vchengfenmsft_3-1670467502819.png

Here is result:

 

Add a new row:

vchengfenmsft_5-1670467650257.png

vchengfenmsft_6-1670467675005.png

 

Update a row:

vchengfenmsft_7-1670467741666.png

vchengfenmsft_8-1670467786641.png

 

 

 

Best Regards

Cheng Feng

 

 

 

Hi Cheng Feng, thanks very much for the insight, I will try this now this morning and report back to you.

Cheers

Ben

bengerry77
Regular Visitor

Hi Cheng, once I modified the cells to suit mine it worked like a charm.

Thanks again, I now even have a better understanding of how its working and the different opperators I can use.

Thanks

Ben

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (4,018)