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

multi checkbox data not saving to SharePoint

Hi all, I have a Powerapps forms with multiple checkboxes that do not save at all to my Sharepoint list. Now all the research i've done turns up people using galleries in powerapps. Is there a way to do this without a gallery? Also, when I try to use the 'Patch' or 'ForAll' code it doesn't seem to be recognised. Any help would be greatly appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Anonymous ,

Do you enable "Allow Multiple Selections" for the Event preference field in your SP List?

 

Please consider set the Update property of the Event preference field data card to following:

ForAll(
       Filter(
          Split(
             Concatenate(
                         If('Any and all events'.Value,  'Any and all events'.Text & ";", ""),
                         If('Nursing homes, etc.'.Value, 'Nursing homes, etc.'.Text & ";", ""),
                         If('Carols by Candlelight'.Value, 'Carols by Candlelight'.Text & ";", ""),
                         If('Remembrance Day'.Value, 'Remembrance Day'.Text & ";", "")
             ),
             ";"
          ),
          !IsBlank(Result)
       ),
       {
         Value: Result
       }
)

Note: I assume that you have enabled "Allow Multiple Selections" for the Event preference field in your SP List.

 

Set the Default property of the 'Any and all events' Checkbox to following:

If(
    'Any and all events'.Text in ThisItem.'Event preference'.Value,
    true,
    false
)

Set the Default property of the 'Nursing homes, etc.' Checkbox to following:

If(
    'Nursing homes, etc.'.Text in ThisItem.'Event preference'.Value,
    true,
    false
)

...

...

 

Please try above solution, hopes it could solve your issue.

 

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.

View solution in original post

9 REPLIES 9
eka24
Super User
Super User

Show a screenshot of the Gallery and also the Patch formula you are using

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

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.

WarrenBelz
Super User
Super User

Hi @Anonymous ,

Are you saying you have check boxes in a form that do not save? What are the Update properties of the Data Cards they are in?

Anonymous
Not applicable

Hi Warren,

I've got a lot of versions (trying different code) and can't find the 'Patch' one yet. But this is the current one using 'ForAll'

 

ForAll(
Split(Concatenate(
If(Any And 'Any and all events'.Value, 'Any and all events'.Text & ",", ""),
If(Any And 'Nursing homes, etc.'.Value, 'Nursing homes, etc.'.Text & ",", ""),
If(Any And 'Carols by Candlelight'.Value, 'Carols by Candlelight'.Text & ",", ""),
If(Any And 'Remembrance Day'.Value, 'Remembrance Day'.Text & ",", "")
),
","
),
{Value: Result}
)
),
{Value: Result}
)

 

interestingly now I'm getting a new error msg
The req operation is invalid. Server Response. XXXform failed: The list item could not be added or updated beause duplicate values were found in the following field(s) in the list {VVVV}

 

 

Hi @Anonymous ,

Could you please share your whole ForAll and Patch formula in your app?

Could you please share a screenshot about your app's configuration?

Further, do you want to save the Checkbox Text value back to your SP List only when the corresponding Checkbox is checked?

 

If you want to save the Checkbox Text value back to your SP List only when the corresponding Checkbox is checked in your Edit form, I think it is not necessary to use Patch function to achieve your needs.

Please set the Update property of the 'Any and all events' field data card in your Edit form to following:

If(
    EditForm1.Mode = FormMode.New,
    If(
        'Any and all events'.Value = true,
         'Any and all events'.Text
    ),
    Parent.Default
)

set the Update property of the 'Nursing homes, etc.' field data card to following:

If(
    EditForm1.Mode = FormMode.New,
    If(
        'Nursing homes, etc.'.Value = true,
        'Nursing homes, etc.'.Text
    ),
    Parent.Default
)

set the Update property of the 'Carols by Candlelight' field data card to following:

If(
    EditForm1.Mode = FormMode.New,
    If(
         'Carols by Candlelight'.Value = true,
         'Carols by Candlelight'.Text
    ),
    Parent.Default
)

...

...

Then when you submit your form data using SubmitForm(EditForm1) formula, the corresponding data card value would be saved back to your SP List.

 

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.
Anonymous
Not applicable

Hi Kris,

 

I'm not sure this code will work for me. The default mode of my form is 'new'. I can't find any Update properties on the checkboxes, 

 

PwrApps_MIB.jpg

 

Hi @Anonymous ,

Based on the screenshot that you mentioned, I found that you add these Checkboxes inside the Event preference field data card, is that true?

Is the "Event preference" data card a Text type column in your SP List?

 

Please consider set the Update property of the Event preference field data card to following:

Concatenate(
            If('Any and all events'.Value,  'Any and all events'.Text & ";", ""),
            If('Nursing homes, etc.'.Value, 'Nursing homes, etc.'.Text & ";", ""),
            If('Carols by Candlelight'.Value, 'Carols by Candlelight'.Text & ";", ""),
            If('Remembrance Day'.Value, 'Remembrance Day'.Text & ";", "")
)

 

Set the Default property of the 'Any and all events' Checkbox to following:

If(
    'Any and all events'.Text in ThisItem.'Event preference',
    true,
    false
)

Set the Default property of the 'Nursing homes, etc.' Checkbox to following:

If(
    'Nursing homes, etc.'.Text in ThisItem.'Event preference',
    true,
    false
)

Set the Default property of the 'Nursing homes, etc.' Checkbox to following:

 

If(
    'Carols by Candlelight'.Text in ThisItem.'Event preference',
    true,
    false
)

...

...

Note: The 'Event preference' represents the Text type column in your SP List, which is used to store these selected Checkbox text values

 

Please try above solution, 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.
Anonymous
Not applicable

Hi, yes the Event preference" data card is a 'Choice' type column in your SP List.  And the Update property of the Event preference shows an error 'Expected Table Value', which i guess is because the SP list item is choice and not text?

Hi @Anonymous ,

Do you enable "Allow Multiple Selections" for the Event preference field in your SP List?

 

Please consider set the Update property of the Event preference field data card to following:

ForAll(
       Filter(
          Split(
             Concatenate(
                         If('Any and all events'.Value,  'Any and all events'.Text & ";", ""),
                         If('Nursing homes, etc.'.Value, 'Nursing homes, etc.'.Text & ";", ""),
                         If('Carols by Candlelight'.Value, 'Carols by Candlelight'.Text & ";", ""),
                         If('Remembrance Day'.Value, 'Remembrance Day'.Text & ";", "")
             ),
             ";"
          ),
          !IsBlank(Result)
       ),
       {
         Value: Result
       }
)

Note: I assume that you have enabled "Allow Multiple Selections" for the Event preference field in your SP List.

 

Set the Default property of the 'Any and all events' Checkbox to following:

If(
    'Any and all events'.Text in ThisItem.'Event preference'.Value,
    true,
    false
)

Set the Default property of the 'Nursing homes, etc.' Checkbox to following:

If(
    'Nursing homes, etc.'.Text in ThisItem.'Event preference'.Value,
    true,
    false
)

...

...

 

Please try above solution, hopes it could solve your issue.

 

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.

View solution in original post

Anonymous
Not applicable

YES! that worked. Thank you so much!

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,415)