cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
msmith
Level 8

Required Field with Patch Part 2

This is a follow up question to this post. https://powerusers.microsoft.com/t5/General-Discussion/Required-Field-with-Patch/td-p/110674

 

If I have 10 controls with the true/false, what is the easiest way to only throw the pop up message if just any one of those controls equals false? If it is just a bunch of IF statements how do I stack all of them?

14 REPLIES 14
PowerApps Staff mabolan
PowerApps Staff

Re: Required Field with Patch Part 2

The easiest way to do this would be to construct a boolean statement like so...

 

If(!(Toggle1 && Toggle1_3 && Toggle1_1 && Toggle1_2), "true","false")

If any of the toggles is false then the single if statement will evaluate to "True"

msmith
Level 8

Re: Required Field with Patch Part 2

Here is what I am using If(!(DataCardValue91 && DataCardValue92 && DataCardValue93 && DataCardValue94), "true","false")

 

Doing this throws an error for each of the DataCardValues saying "Invalid argument type. Expecting one of the following:Boolean, Number, Text"

 

I tried replacing the true, false with Yes, No, but that does not work either.

PowerApps Staff mabolan
PowerApps Staff

Re: Required Field with Patch Part 2

I think you'll need to apply an additional function for each DataCardValue to get a true/false.

 

For example, if you wanted to make sure none of the fields were empty, you could write the following

 

 If((IsBlank(DataCardValue91) || IsBlank(DataCardValue92) || IsBlank(DataCardValue93) || IsBlank(DataCardValue94)), "true","false")

Do you mind sharing what types of controls your DataCardValues are?

msmith
Level 8

Re: Required Field with Patch Part 2

I have a screen shot of the one I am using. I first added the Yes\No Checkbox from SharePoint Online and then changed it to be the edit Options as you see in the attached image. 

 

I am still getting the error with the additional funchtion.

PowerApps Staff mabolan
PowerApps Staff

Re: Required Field with Patch Part 2

I see... try changing the query to reference the DataCard, instead of the DataCardValue, like so:

 

If(DataCard.Update,'true','false')
msmith
Level 8

Re: Required Field with Patch Part 2

I think we are getting closer. I was able to get this not have any errors with what you provided, but I can't ge the pop up to happen anymore. I have attached a screen capture showing what I am using and you will notice that I have Yes,No, and I did try true,false aslo.

Super User
Super User

Re: Required Field with Patch Part 2

I do this differently. I set all of the fields to OnChange (or OnCheck if you want) to UpdateContext({PopUpVar: true}) that way if they get toggled they fire the popup. Then when you interact with the popup and are done you just set PopUpVar back to false. 

 

You can see similar in action in my Password Screen app.

Shane - Microsoft MVP, YouTube, and PowerApps Consulting for when you are in a bind to get this fixed quickly. And finally we now have PowerApps Training
PowerApps Staff mabolan
PowerApps Staff

Re: Required Field with Patch Part 2

Yes/No and True/False were just example text. Instead of outputing strings, you can conditionally open your popup. For example, if the If statement evaluates to true, you can call the code that opens up your popup.

msmith
Level 8

Re: Required Field with Patch Part 2

I am starting to get a headache trying to wrap my head around some of this. 😉

 

Let me take a step back to explain this a bit. I have a group of 5 toggle switches with one text field. If anyone of those toggle switches equal false or No and the text field is Blank, then the pop up should trigger using Set(MyVis,true).

 

So basically what I have so far is something checking all the switches and not the text field. Is the outputting string another If statement with false as being the condition? 

If((DataCard123.Update) || (DataCard124.Update) || (DataCard125.Update), If("false"(Set(MyVis,true))

 

I am really confused at this point. Sorry, I am not understanding.

Helpful resources

Announcements
thirdimage

Power Automate 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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

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