cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Accubohr
Frequent Visitor

How to change values in a Form, by using checkboxes (single choice)

I (try to) create an app for a evaluation process more or less as a check list. There are 9 main categories in it. Every category in it have 3 checkboxes. It's only allowed select one checkbox for each category. As a data source I used a Sharepoint list. The list columns are formatted as numbers. On this columns based other calculated columns. When I create a new record with a "New Form" I can select one of the checkboxes in every main category. So far so good. I save the recordset by using the "standard" PA functionality submit. If I try to change an existing recordset via the "Edit Form", I have some trouble with the right program code. When the "Edit Form" was opened, the existing values should be set a the checkboxes "Default". As you can see in the attached image. If I like to change the checkbox default e.g. the red who is correspondent with the SP Column "KAT3_1", I check an other checkbox, e.g. the green. Then this checkbox value, should be the "new default" so to say.
I set the default value of the checkbox like that: e.g. 
Default = If(Checkbox_KAT1_1 Or Checkbox_KAT2_1 = true, false, Parent.Default)
The "OnCheck" property of every checkbox I set to: Reset(Checkbox_KATx_x); Reset(Checkbox_KAT_x_x)
But It doesn't work as I (as a Power Apps Starter - more or less) expected.

Maybe you have a more "professional" solution for my issue. Thank you in advance for some help.

PA_Questions.png

4 REPLIES 4
DylanSimons
Resolver III
Resolver III


Default = If(Checkbox_KAT1_1 Or Checkbox_KAT2_1 = true, false, Parent.Default)

That if statement is not correct for 3 reasons;

  1. you need to complete each logical comparison before the "or" or "and" operator. It would be something like this: "If(Checkbox_KAT1_1 = true Or Checkbox_KAT2_1 = true....."
  2. you need to get the value of the checkbox, like this: Checkbox_KAT2_1.Value
  3. that Or statement is not correct, you can either use;
    1. the Or() function, which would look like this: Or(Checkbox_KAT1_1 = true,Checkbox_KAT2_1 = true)
    2. the || operator, which would look like this: Checkbox_KAT1_1 = true || Checkbox_KAT2_1 = true

In the end, the default property should be;

Default = If(Checkbox_KAT1_1.Value=true || Checkbox_KAT2_1.Value=true, false, Parent.Default)

 

 

Pro-tip - if the variable is a true/false (AKA "boolean"), you don't need the "=true" because it is already true or false :). The final product would be:

 

Default = If(Checkbox_KAT1_1.Value || Checkbox_KAT2_1.Value, false, Parent.Default)

 

 

Let me know if you have questions!

Thank you very much. I will check it on coming Monday at work. I will inform you ASAP.

Sorry first for delayed answer.
I do this as a first step. I can select 2 checkboxes then 😞
PS:
I use the Text property of the checkboxes to get a number, because the Share Point Column is formatted as a number. Maybe a bit to complicated but it works well.

PA 01.jpg

 

If I try this, it works like I expected, but only when I use it for 1 checkbox. If I try to this for the other 2 checkboxes, a error message comes up. 

PA 02.jpg

This is the error message that I've got

PA 03.jpg

Accubohr
Frequent Visitor

Any ideas?

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (1,803)