cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anthjanz_42
Helper I
Helper I

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 @Anthjanz_42 ,

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 III
Super User III

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 III
Super User III

Hi @Anthjanz_42 ,

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?

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 @Anthjanz_42 ,

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.

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 @Anthjanz_42 ,

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.

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 @Anthjanz_42 ,

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

YES! that worked. Thank you so much!

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (34,869)