cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Post Patron
Post Patron

Restrict 'Yes/No' field to one YES

Hi Power Apps Community,

I am trying to build an app where in a Gallery of items I have a field - let's call this FieldA, which is a 'Yes/No' field. Out of all the items in the Gallery, if FieldA is 'Yes' for any one item, then you may not have 'Yes' for any other item in the Gallery.

I would really appreciate any assistance.

Thank you in advance.

6 REPLIES 6
Super User III
Super User III

Can you show a screenshot?

Meanwhile try:

If(ThisItem.Column="Yes","Yes","No")

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Hi @eka24 

Sure. The screenshot below would show a list of all the items in the Gallery. Out of all the items in the Gallery, a user may only select one of the items to be identified as a 'Main Item'. If one is identified, all other items should be false.

Data_Enthusiast_0-1604386944699.png

The screenshot below shows the control used to select whether the item is a 'Main Item' or not.

Data_Enthusiast_1-1604386962411.png

Hope this helps. 

 

It seems the Toggle used to select main item is not inside the Gallery. 

 

If(Toggle1.Value,"true","false")

If that doesn't work, click the items inside the Gallery to display the ThisItem

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

 

Hi @eka24 

Yes, there is a separate Details Page for editing the fields.

With regards to your code, which property of the Toggle would I add the code to?

Please in design mode, click inside the Gallery to display the formula in the Label and take a screenshot

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Hi @eka24 

This is the formula used for the Label.

Data_Enthusiast_0-1604402150864.png

 

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (23,081)