cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper V
Helper V

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
Highlighted
Power Apps
Power Apps

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"

Highlighted
Helper V
Helper V

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.

Highlighted
Power Apps
Power Apps

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?

Highlighted
Helper V
Helper V

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.

Highlighted
Power Apps
Power Apps

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')
Highlighted
Helper V
Helper V

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.

Highlighted
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
Highlighted
Power Apps
Power Apps

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.

Highlighted
Helper V
Helper V

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
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,692)