cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

Patch items based on checkbox values.

Hi guys, 

I am trying to make an SD Scale in Powerapps, it looks like this: 

Patch.PNG

 I have an SP List with corresponding column names as the opposites, so on called Brugbar/Ubrugelig etc. What i would like, if it is possible at all is to patch the number(what checkbox is selected) to that column, so for example: 

If, in between labels Brugbar & Ubrugelig i have selected number 5(counting from the left) i would then like to be able to press the button and patch the number 5 to that column in the SharePoint List.

Liste.PNG

 

 

I have come up with a solution, however that requires 36 If statements, which i feel probably is not gonna be that stable 🙂 

Thanks in advance. 
- Tobi

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Dual Super User III
Dual Super User III

Re: Patch items based on checkbox values.

Hey @Anonymous 

 

You can use the expression as:

Patch(
DataSource,
Defaults(DataSource),
{
"Brugbar/Ubregelig": If(Checkbox1.Value, 1,Checkbox1_1.Value,2, Checkbox1_2.Value, 3, Checkbox1_3.Value, 4, Checkbox1_4.Value, 5, Checkbox1_5, 6),
"Logisk/Unilogisk": If(Checkbox2.Value, 1,Checkbox2_1.Value,2, Checkbox2_2.Value, 3, Checkbox2_3.Value, 4, Checkbox2_4.Value, 5, Checkbox2_5, 6),
...
}
)

This will fetch the results accordingly and patch them. You need to use the If loop for all the columns.

In case you want to clear the selection if user tries to change input on any checkbox for each row, you can set the "OnChange" property of all the checkboxes as:

Checkbox1: OnChange: Reset(Checkbox1_1);Reset(Checkbox1_2); ... -> Similarly add the checkboxes you want to clear when this is changed.

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

1 REPLY 1
Highlighted
Dual Super User III
Dual Super User III

Re: Patch items based on checkbox values.

Hey @Anonymous 

 

You can use the expression as:

Patch(
DataSource,
Defaults(DataSource),
{
"Brugbar/Ubregelig": If(Checkbox1.Value, 1,Checkbox1_1.Value,2, Checkbox1_2.Value, 3, Checkbox1_3.Value, 4, Checkbox1_4.Value, 5, Checkbox1_5, 6),
"Logisk/Unilogisk": If(Checkbox2.Value, 1,Checkbox2_1.Value,2, Checkbox2_2.Value, 3, Checkbox2_3.Value, 4, Checkbox2_4.Value, 5, Checkbox2_5, 6),
...
}
)

This will fetch the results accordingly and patch them. You need to use the If loop for all the columns.

In case you want to clear the selection if user tries to change input on any checkbox for each row, you can set the "OnChange" property of all the checkboxes as:

Checkbox1: OnChange: Reset(Checkbox1_1);Reset(Checkbox1_2); ... -> Similarly add the checkboxes you want to clear when this is changed.

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Helpful resources

Announcements
Ignite

Microsoft Ignite

This will be a conference that you do not want to miss!

secondImage

New Return to Workplace

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

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

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