cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
UB400
Kudo Kingpin
Kudo Kingpin

Checking to see if a Record exists, if it does then Patch an update, if not then create a new record

I'm building a "Survey" App that collects User responses to Questions, each User's response is in a separate record in the Responses table. The User should be able to save their response prior to Submitting their response, in order to come back to it to make any changes prior to Submitting their response.

 

How can I check to see if a Record exists for this particular response, if not then create a new record.

 

I was thinking of testing by using the lookup function, to see if a record existed that had the Question ID and User().Email, as the combination of these would be unique for each record.

 

Could someone kindly guide me on this and if possible give me an example of the syntax to use?

 

Thanks.

16 REPLIES 16

@bdc604 you can now increase the limit beyond 500 records (upto 2000 I believe). I can understand your frustration, but not the sentiment you express. With a little exploration and help from the great community here, it's amazing what one can achieve with PowerApps, there's no shortage of amazing Apps that have been built by members of the communiy here.

 

If you're just trolling, then I suggest you do it elsewhere. The PowerApps community has by far the best and most helpful members I've come across anywhere.

The EXPERIMENTAL 2000 row limit is equally arbitrary and almost as prohibitive as 500. I have not been able to get the feature to perform correctly (but there are no guaranties with experimental features).

 

I think the frustration is more than fair. @bdc604 is not attacking the PowerApps community. He or she is holding up a mirror to the flaws in a badly formed (or at the very least prematurely released) product that has developers writing work arounds to accomplish basic tasks.

Heres a question; has SharePoint delegation been resolved yet? That is, having SharePoint perform any filtering requirements on the backend and returning only the result? I'm finding conflicting answers online; yes it has, no it hasn't.

 

If I have a list with 5000 items and only need to return 1 based on a filter condition, will PowerApps (or Flow for that matter) give up after looking at the first 500 (or first 2000) and say 'meh, I tried, couldn't find it', even though it is actually there?

nickduxfield
Responsive Resident
Responsive Resident

You may simply hide a submit button based on a filter query.
Your filter should narrow down to a collection of 50 items that you can query against to be helpful.
Using date fields, author.email and submission status should narrow it effectively. As a user may only ever sumit up to 500 items in a given week.

You can easily collect a distinct collection of these 3 columns to compare using the in operator.
aweaver
New Member

I am looking for a similar solution. I have two tables. Table A has one email and one phone number column. I need to perform a lookup in another table, Table B. Table B has 4 different phone number columns (home, work, cell, other) and two different email (home and work). I need table A to run essentially a conditional lookup on table B, for 4 different columns on the phone and then 2 columns for the email and then return a boolean value. Thoughts?.

Hi @Mike8 , I tried this approach, but it is always adding a new record instead of updating the existing one. Can you help me here

Hello @kiritisaranam ,

I will try my best to help.
Are you referring to the following post?
If(
IsBlank(LookUp(Responses,QuestionID=[the ID you want to check]&&UserEmail=User().Email)), <-- returns true or false
Collect(Responses,{...}), <--- Adds a record (if the expression above is true.)
Patch(Responses,LookUp(Responses,QuestionID=[the ID you want to check]&&UserEmail=User().Email),{....}) <--Updates if false
)

It was 2,5 years ago. Maybe something changed.
I think there weren't any comments back then. Hehe.

If you provide to me a sample of the collection that you would like to insert or update data, I can build a formula for you.

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

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.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (1,126)