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

Re: How to patch a checkbox from a gallery to a Sharepoint list

@v-xida-msft  I assume with that code I am to get rid of the " ... "?

 

Also, what do you mean by ensure I have added a proper data source? If you mean use a list rather than set up a collection with the application, the only reason it's set up that way is because the person who helped me get the gallery working recommended it.

 

Here is a picture of the connected data sources: 

 

1.PNG

Community Support Team
Community Support Team

Re: How to patch a checkbox from a gallery to a Sharepoint list

Hi @rsparks ,

Currently, I could not reproduce your issue on my side. The standard formula to save a collection data back to a SP list as below:

ForAll(
         Collection1,
         Patch(
                   'YourSPList',
                    Defaults('YourSPList'),
                     {
                         SPColumn1: Collection1[@Column1],
                         SPColumn2: Collection1[@Column2],
                         SPColumn3: Collection1[@Column3],
                         ...
                     }
         )
)

The standard formula for saving Gallery Items back to SP list as below:

ForAll(
           Gallery1.AllItems,
           Patch(
'YourSPList',
Defaults('YourSPList'),
{
SPColumn1: Column1FromGallery,
SPColumn2: Column2FromGallery,
SPColumn3: Column3FromGallery,
...
}
) )

Please also check and see if the following video would help in your scenario:

https://www.youtube.com/watch?v=MclJ_O9HvJQ&t=1308s

 

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.
rsparks
Level: Powered On

Re: How to patch a checkbox from a gallery to a Sharepoint list

@v-xida-msft  That video came close to my scenario, but was still slightly different. My problems seem to arise from the fact that my gallery has only 1 checkbox, with extra options being automatically generated.

 

Whereas in the video each button or checkbox is its own object that can be directly referenced. 

 

As mentioned earlier I can patch the data selected in the gallery via checkbox, but it will only patch 1 option. If I add more checkboxes, so that I have one for each potential option, will this solve my issue?

Community Support Team
Community Support Team

Re: How to patch a checkbox from a gallery to a Sharepoint list

Hi @rsparks ,

Just as I mentioned above, the ForAll function and Patch function could solved your scenario.

 

As an alternative solution, please consider take a try with the following workaround:

Set the OnCheck property of the Checkbox control in Gallery to following:

Collect(
colCosts, { id: ThisItem.id cost:ThisItem.cost,
car: ThisItem.car,
option: ThisItem.option } )

Set the OnUncheck property of the Checkbox control in Gallery to following:

RemoveIf(colCosts, id = ThisItem.id)

Then moduify your ForAll formula as below:

Patch('Lease Quotes', Defaults('Lease Quotes'),{'Vehicle Type': Dropdown8_1.Selected.Title}, {'Vehicle Cost': 'Total calc'.Text}, {'Lease Period': Dropdown10.Selected.Text}, {'Distance over lease': Dropdown1.Selected.Text}, {'E-tag': Dropdown2_1.Selected.Text}, {'Decal Amount': 'Decal calc'.Text}, {Insurance: 50});
ForAll(
             colCosts,
             Patch(
                        'Lease Quotes',
                         Defaults('Lease Quotes'),
                         {
                             'Optional Extras Package': colCosts[@option]
                         }
                )
);
Navigate(Finish, ScreenTransition.None)

Please 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.
rsparks
Level: Powered On

Re: How to patch a checkbox from a gallery to a Sharepoint list

@v-xida-msft Alright it's finally patching them all, but just to separate lines:

 

nice.PNG

 

How can I get them to patch to the same row, with commas spacing them out? For example First Aid Kit, Rubber Mats, Window Tint.

Community Support Team
Community Support Team

Re: How to patch a checkbox from a gallery to a Sharepoint list

Hi @rsparks ,

Do you want to merge the ForAll formula result and the first Patch formula into same row in your SP List?

 

If you want to merge the ForAll formula result and the first Patch formula into same row in your SP List, I think it is not necessary to add ForAll formula in your app.

I have made a test on my side, please take a try with the following workaround:

Set(
CurrentSubmittedRecord,
Patch('Lease Quotes', Defaults('Lease Quotes'),{'Vehicle Type': Dropdown8_1.Selected.Title}, {'Vehicle Cost': 'Total calc'.Text}, {'Lease Period': Dropdown10.Selected.Text}, {'Distance over lease': Dropdown1.Selected.Text}, {'E-tag': Dropdown2_1.Selected.Text}, {'Decal Amount': 'Decal calc'.Text}, {Insurance: 50})
);
Patch(
'Lease Quotes',
LookUp('Lease Quotes', ID = CurrentSubmittedRecord.ID),
{
'Optional Extras Package': Concat(colCosts, option & ", ")
}
); Navigate(Finish, ScreenTransition.None)

 or

Patch(
'Lease Quotes',
Defaults('Lease Quotes'),
{
'Vehicle Type': Dropdown8_1.Selected.Title,
'Vehicle Cost': 'Total calc'.Text,
'Lease Period': Dropdown10.Selected.Text,
'Distance over lease': Dropdown1.Selected.Text,
'E-tag': Dropdown2_1.Selected.Text,
'Decal Amount': 'Decal calc'.Text,
Insurance: 50,
'Optional Extras Package': Concat(colCosts, option & ", ") /* <-- Add formula here */
}
); Navigate(Finish, ScreenTransition.None)

Please 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.

View solution in original post

rsparks
Level: Powered On

Re: How to patch a checkbox from a gallery to a Sharepoint list

That's working well, thanks heaps. 

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

Power Apps Community User Group Member Badge

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

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (4,850)