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

how to uncheck checkbox automatically and allow user to select only one

I have Dataverse table with column created as "Yes/No" type. 

When I create PowerApps it will display as "Drop", instead we want to have checkboxes for Yes and No option. Also if a user selects one option the other one should be automatically unchecked. 

 

For that I have used below steps.  

1. Create gallery under Column_datacard.

2. Set existing datacardvalue1.Visible =false

3. Set exisiting Datacardvalue1.DefaultselectedItem = ForAll(details, {Value:Title})

3. insert Checkbox under the Gallery.

4. Set Checkbox "Label" property=ThisItem.Value

5. Set gallery "Items" Property =Choices('Column(TableName)')

6. Set Oncheck Property on checkbox as "Collect(details, {Title:ThisItem.value})

6. Set ONUncheck property on checkbox as "removeIF(details, Title=ThisItem.value)

 

Here I am trying to collect details using collections. Now the issue is that we can select both the answers from this checkbox. Because this is part of gallery, I am not sure how to set rule if one is selected then the other should automatically uncheck. Is there any other alternative solution for this instead of going through all these steps? 

End of the day we need to save content back to Dataverse column.

 

 

 

11 REPLIES 11
CNT
Super User
Super User

@rajkumar88 The best solution is to use a Radio control. Please follow these steps (In my case I have a Dataverse table called People and a Yes/No field called Happy),

1. Add this field to the form, remove the dropdown and add a Radio control.

2. Set the Items property for the Radio control like below,

CNT_0-1622283689902.pngCNT_1-1622283728870.png

3. Set the default of the Radio control to,

CNT_2-1622284378683.png

4. Set the Update property of the DataCard to,

CNT_6-1622284604796.png

 

All done!

 

@CNT , I don't see "Default" Property for Radio Group at all. I am using right Radio control? I can and input acttion called "RadioGroup". And I used this one to set "Items" but even "Items" is also showing it as 0 and 1 instead of "yes or No" option.

TheRobRush
Super User
Super User

-

_____________________________________________________________________________________
Like my answer? - Hit that Thumbs Up. Resolved the Issue? - Hit Accept as Solution.
This helps others find solutions to future issues!

@rajkumar88 

Select the Radio Control to see its Items and Defaults property. When you select the Radio control, you will see, the name "Radio" in the Properties pane,

CNT_3-1622301672060.png

Initially the Radio will show 0 and 1. When you set the Items property correctly like I have shown (Setting it to ["Yes","No"] WILL NOT WORK in your case , then it will change to Yes and No.

Hope this helps!

CNT
Super User
Super User

@rajkumar88 If you share the name of your Dataverse table and the name of the Choice field, I can give you the exact formulas (send screen shots). Thanks!

@CNT , I have used exactly as you mentioned. Still no luck. Below screen shot doesn't show anywhere "default property".

 

rajkumar88_0-1622306313858.png

 

I did applied RadioGroup exactly with the choice formula.

rajkumar88_1-1622306401249.png

 

And then updated CovidpositiveDatacard with the radiogroup1.selected.value. 

 

@TheRobRush  Did you posted something here? I don't see your reply

@rajkumar88 OK. Got it. You are in PowerApps for Teams and Radio works differently there.

1. To change 0,1 to Yes and No, do this,

CNT_0-1622316382993.png

 

2. Set the DefaultSelectedItems to,

CNT_1-1622316885899.png

 

Hope this helps!

 

Thanks A lot. It worked fine now. 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,176)