cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Mammoth
Level: Powered On

Patch Isn't Working in If Statement with Lookup

Hi,

 

I'm trying to have a button set up that takes the text in a label and sees if it is in an SQL database.

 

If it is not, then it will add the text in that label (and the user's name and email as well) to the database. The error in the formula is within the patch statement, but if I put the same patch formula in a different button without the if or lookup statements then it works. 

 

I previously was successful adding a new value into a database using 'SubmitForm' and a text input, but I need it to add through a label as the user will select the values from dropdown lists and the label concatenates the dropdown values.

 

Any help will be much appreciated.

 

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Patch Isn't Working in If Statement with Lookup

Hi @Mammoth

Within the true part of an If statement, you can call multiple functions provided that each function call is terminated with an ; symbol.

Therefore if you replace AND with ;  (ie terminate your call to Patch with ; before calling Notify), this means that when your If statement resolves to true, it will call Patch followed by Notify. In this case, the success notification will not always show, regardless of the outcome. Let me know if this makes a bit more sense to you.

 


 

View solution in original post

5 REPLIES 5
Super User
Super User

Re: Patch Isn't Working in If Statement with Lookup

Hi @Mammoth

I think it's possibly the AND statement that you have after the Patch. If you want to Patch a record and then show a notification, you can separate the calls to Patch and Notify with a semi-colon instead of AND.

Mammoth
Level: Powered On

Re: Patch Isn't Working in If Statement with Lookup

Hi @timl,

 

Taking out the AND Notify has worked, but I'm not sure what you mean by separating it with a semi-colon?

 

Currently, if it already exists or NULL values are added then the error notification pops up (which is what I want). The user can also add the new value to the database but does not confirm to the user it has uploaded successfully. If I do separate it with a semi-colon and then add the success notification type, will that not always show a success regardless of the outcome?

Super User
Super User

Re: Patch Isn't Working in If Statement with Lookup

Hi @Mammoth

Within the true part of an If statement, you can call multiple functions provided that each function call is terminated with an ; symbol.

Therefore if you replace AND with ;  (ie terminate your call to Patch with ; before calling Notify), this means that when your If statement resolves to true, it will call Patch followed by Notify. In this case, the success notification will not always show, regardless of the outcome. Let me know if this makes a bit more sense to you.

 


 

View solution in original post

Mammoth
Level: Powered On

Re: Patch Isn't Working in If Statement with Lookup

@timl you are a legend...thank you Smiley Very Happy

Super User
Super User

Re: Patch Isn't Working in If Statement with Lookup

Thanks @Mammoth, you're welcome!

Helpful resources

Announcements
thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (5,406)