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

Update excel row - Create a new row if it can't locate an existing match

Hello, I am currently trying to create two flows that are linked to separate MS forms but both feed the same excel sheet.

 

First Flow: Form Submission - Create new excel row (This one works fine.)

 

Second flow: Form Submission - Get list of Excel entries - Condition: Is there an existing email address that matches?

 

If yes: Update the row (this works fine.)

If no: Create a new row. 

 

The only way I can seem to create a new row is by using the 'apply to each' function when it checks for a matching email address, the problem is if it doesn't find a matching one it creates a new record every time, instead of just once. Can anyone help please?

 

Flow issue.png

1 ACCEPTED SOLUTION

Accepted Solutions
bibhupanigrahi
Resolver III
Resolver III

Hi @techiecraig, there may be other ways to handle this but I would handle it this way:

  1. Initialize a Boolean variable called 'FormAdded' and set it to 'false' at the beginning.
  2. Add a new condition in the 'No' block of the first condition. This new condition will check whether 'FormAdded' is 'true', and then create a new row only when it is 'false'. It means the new row will be created only when the client email is not found and also 'FormAdded' value is false.
  3. Immediately after the 'Add a row into a table' action, update the 'FormAdded' variable to 'true'.

This will create only one row for the same client in an instance of the flow. Hope this helps!

View solution in original post

5 REPLIES 5
bibhupanigrahi
Resolver III
Resolver III

Hi @techiecraig, there may be other ways to handle this but I would handle it this way:

  1. Initialize a Boolean variable called 'FormAdded' and set it to 'false' at the beginning.
  2. Add a new condition in the 'No' block of the first condition. This new condition will check whether 'FormAdded' is 'true', and then create a new row only when it is 'false'. It means the new row will be created only when the client email is not found and also 'FormAdded' value is false.
  3. Immediately after the 'Add a row into a table' action, update the 'FormAdded' variable to 'true'.

This will create only one row for the same client in an instance of the flow. Hope this helps!

View solution in original post

bradleyhorton
Resolver II
Resolver II

There might be a neater way, but I think you should be able use Filter array (by email address) to find if the email address of the second forms exists. You can then use Length(filter array) to see how many entries were matched. Then you can use your condition if length = 0 add a row, otherwise update a row.

Currently I think if you had 5 entries in the list and a new email response, you'd get 5 rows with the new email address?

Yes that is currently what's happening, I had 11 existing entries and it added 11 rows of the new email address, it's going to end up quite a big spreadsheet... thanks for your idea I will give it a go!

Thank you for your suggestion! I shall give this a go and will report back.

This worked, thank you so much!

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Microsoft Ignite 768x460.png

Find your focus

Explore the latest tools,training sessions,technical expertise, networking and more.

Users online (1,541)