cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PytByt
Level: Powered On

How to patch sharepoint list using checkbox

hi all...

 

i need to understand how the expression to patch using chexkbox control in powerapps.

 

the idea is, if the checkbox is checked, it sent YES word into my sharepoint list which is a single line of text type.

 

please see the figure below:

 

checkbox 1.png

what should i do?

 

thanks,

pytbyt 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: How to patch sharepoint list using checkbox

Hi @PytByt ,

Could you please share a bit more about your Patch formula?

Where do you put your Patch formula? Within the OnCheck property of the Checkbox control?

Further, do you want to set "Yes" or "No" word into the Single line text column of your SP list within same record when you check or uncheck the Checkbox?

 

Based on the needs that you mentioned, I have made a test on my side, please take a try with the following workaround:3.JPG

 

4.JPG

Set the OnSelect property of the Checkbox control to following:

If(
    Checkbox1.Value = true,
    If(                                 /* <-- Patch "YES" word to single line text column in your SP list */
       IsBlank(SubmittedItem),
       Set(
           SubmittedItem,
           Patch(YourSPList, Defaults(YourSPList), {SingleTextColumn: "YES"})            /* <-- Add new reocrd */ 
       ),
       Patch(YourSPList, LookUp(YourSPList, ID = SubmittedItem.ID), {SingleTextColumn: "YES"})     /* <-- Modify existing record */
    ),
    If(                                   /* <-- Patch "NO" word to single line text column in your SP list */
       IsBlank(SubmittedItem),
       Set(
           SubmittedItem,
           Patch(YourSPList, Defaults(YourSPList), {SingleTextColumn: "NO"})    /* <-- Add new record */
       ),
       Patch(YourSPList, LookUp(YourSPList, ID = SubmittedItem.ID), {SingleTextColumn: "NO"})     /* <-- Modify existing record */
    )
)

Note: The SingleTextColumn represents the Single Text type column in your SP List. You could apply above formula to other Checkboxes in your app.

Set the OnVisible property of the current screen to following (when you wants to add a new record, please reset the SubmittedItem variable using the following formula):

Set(SubmittedItem, Blank())

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
4 REPLIES 4
NMCLEOD
Level: Powered On

Re: How to patch sharepoint list using checkbox

Hi!  The 'Value' property of the checkbox control has a boolean (true or false) based on whether the checkbox is selected or not.  In my apps I'll send this boolean back to SharePoint as a single line of text instead of converting it to Yes/No.  But if you really want to send Yes/No, I'd suggest having another label with a Switch or If statement, e.g. If(Checkbox1.value = true, "Yes", "No").  If you need help writing your Patch code - see link here.

 

PytByt
Level: Powered On

Re: How to patch sharepoint list using checkbox


@NMCLEOD wrote:

Hi!  The 'Value' property of the checkbox control has a boolean (true or false) based on whether the checkbox is selected or not.  In my apps I'll send this boolean back to SharePoint as a single line of text instead of converting it to Yes/No.  But if you really want to send Yes/No, I'd suggest having another label with a Switch or If statement, e.g. If(Checkbox1.value = true, "Yes", "No").  If you need help writing your Patch code - see link here.

 


Hi @NMCLEOD 

 

I tried your suggestion, and it work.

However, my question is single line can be edited once the checkbox is checked? 

In my experiment, the code you gave is creating another record new record with only one single line of text type is filled with "Yes" and the other column is empty (please refer to my SS in above post).

 

Is there any work around to make the checkbox in editable to sharepoint list when its checked and unchecked? 

 

I mean, when the checkbox is checked is putting the "Yes" word into the SP list, and put the "No" word when its unchecked.. BUT in the same record column, and NOT creating another new record in the SP list. Is it possible?

 

Thanks,

pytbyt

Community Support Team
Community Support Team

Re: How to patch sharepoint list using checkbox

Hi @PytByt ,

Could you please share a bit more about your Patch formula?

Where do you put your Patch formula? Within the OnCheck property of the Checkbox control?

Further, do you want to set "Yes" or "No" word into the Single line text column of your SP list within same record when you check or uncheck the Checkbox?

 

Based on the needs that you mentioned, I have made a test on my side, please take a try with the following workaround:3.JPG

 

4.JPG

Set the OnSelect property of the Checkbox control to following:

If(
    Checkbox1.Value = true,
    If(                                 /* <-- Patch "YES" word to single line text column in your SP list */
       IsBlank(SubmittedItem),
       Set(
           SubmittedItem,
           Patch(YourSPList, Defaults(YourSPList), {SingleTextColumn: "YES"})            /* <-- Add new reocrd */ 
       ),
       Patch(YourSPList, LookUp(YourSPList, ID = SubmittedItem.ID), {SingleTextColumn: "YES"})     /* <-- Modify existing record */
    ),
    If(                                   /* <-- Patch "NO" word to single line text column in your SP list */
       IsBlank(SubmittedItem),
       Set(
           SubmittedItem,
           Patch(YourSPList, Defaults(YourSPList), {SingleTextColumn: "NO"})    /* <-- Add new record */
       ),
       Patch(YourSPList, LookUp(YourSPList, ID = SubmittedItem.ID), {SingleTextColumn: "NO"})     /* <-- Modify existing record */
    )
)

Note: The SingleTextColumn represents the Single Text type column in your SP List. You could apply above formula to other Checkboxes in your app.

Set the OnVisible property of the current screen to following (when you wants to add a new record, please reset the SubmittedItem variable using the following formula):

Set(SubmittedItem, Blank())

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
PytByt
Level: Powered On

Re: How to patch sharepoint list using checkbox

Thank you @v-xida-msft 

 

i will try that, and get back to you later on.

 

regards.

pytbyt

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

PowerApps Monthly Community Call

Next Wednesday, August 21st at 8am PDT

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

SixthImage

Power Summit Australia 2019

August 20-23rd 2019

Users Online
Currently online: 255 members 3,991 guests
Please welcome our newest community members: