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

Saving user and choices to a list.

Hi, I have a PowerApp I have been working on that presents some data from an excel table in a Gallery,

I have added to this gallery a tickbox as shown below.Untitled-2.png

The purpose of the app is that multiple users can access the app, tick multiple boxes, and then click save.

Obviously with multiple people picking multiple options there will be overlaps between them, these need to be recorded.

 

I have created a list in sharepoint "AcademicChoices" and given it the extra column of "Volunteer"

Untitled2.png

How I imagine this will work is that when the user has ticked some boxes it will send the "Project Title" to the "Title" column, and the username of the person logged into the app to the "Volunteer" column for each of their ticked items.

 

Here is a crude example of how it would work assuming that the user of the powerapps username was "stan"

 

Untitled-3.pngUntitled2.png

 

Thoughts on this? Or is there perhaps a better way of trying to record the information I am looking for?

Thanks.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Saving user and choices to a list.

Hi @AaranWork,

Could you please share a bit more about your scenario?

Do you want to record the items the user checked within the Gallery into a SP list?

If you want to record the items the user checked within the Gallery into a SP list, I agree with your thought. I think the Patch function could achieve your needs.

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

Within the Gallery, set the OnSelect property of the Check Box control to following:

If(
    Checkbox1.Value=true,
    Patch('20190114_case9_1', Defaults('20190114_case9_1'), {Title: ThisItem.'Project Title', Volunteer: User().FullName})
)

On your side, you should type:

If(
    Checkbox1.Value=true,
    Patch(
'AcademicChoices',
Defaults('AcademicChoices'),
{
Title: ThisItem.'Project Title',
Volunteer: User().FullName
}
) )

More details about the Patch function, please check the following article:

Patch function

 

Best regards,

Kris

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

5 REPLIES 5
Community Support Team
Community Support Team

Re: Saving user and choices to a list.

Hi @AaranWork,

Could you please share a bit more about your scenario?

Do you want to record the items the user checked within the Gallery into a SP list?

If you want to record the items the user checked within the Gallery into a SP list, I agree with your thought. I think the Patch function could achieve your needs.

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

Within the Gallery, set the OnSelect property of the Check Box control to following:

If(
    Checkbox1.Value=true,
    Patch('20190114_case9_1', Defaults('20190114_case9_1'), {Title: ThisItem.'Project Title', Volunteer: User().FullName})
)

On your side, you should type:

If(
    Checkbox1.Value=true,
    Patch(
'AcademicChoices',
Defaults('AcademicChoices'),
{
Title: ThisItem.'Project Title',
Volunteer: User().FullName
}
) )

More details about the Patch function, please check the following article:

Patch function

 

Best regards,

Kris

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

AaranWork
Level: Powered On

Re: Saving user and choices to a list.

Hi, yes I would like to save it in a sp list so that it could be used in another powerapp, however the problems I am running into are that multiple peoples choices will need to be recorded without overwriting data, for example multiple people could volunteer for the same project, so if jan, sammy, and stuart, were all to say they wanted to volunteer for iains project then it would need to record that all three people were interested.

Community Support Team
Community Support Team

Re: Saving user and choices to a list.

Hi @AaranWork,

Based on the needs that you mentioned, I think the solution I provided above could achieve your needs.

When you click Check Box within your Gallery, the Patch formula would be executed, then save a new record into your AcademicChoice SP list without overwriting records with same Title value.

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

 

If the issue is solved on your side, please go ahead to click "Accept as Solution" to identify this thread has been solved for other users.

 

Best regards,

Kris

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

Re: Saving user and choices to a list.

Thank you, I will give this a go now and see if I can get it working.

 

edit:

 

This works perfectly, thank you.

I would like to expand on the functionality so that they are able to uncheck and delete the value from the list, I will try and figure out how to do this.

AaranWork
Level: Powered On

Re: Saving user and choices to a list.

I made some changesto capture more info and try to remove the values if the user changes their mind and unticks a box

 

    If(
        Checkbox1.Value=true,
        Patch(
              'AcademicChoices', 
               Defaults('AcademicChoices'), 
               {
                  Student: ThisItem.student_x0020_email, 
                  Title: ThisItem.project, 
                  Volunteer: User().FullName
               }
         ),
Checkbox1.Value=false,
        Remove(
              'AcademicChoices', 
               Defaults('AcademicChoices'), 
               {
                  Student: ThisItem.student_x0020_email, 
                  Title: ThisItem.project, 
                  Volunteer: User().FullName
               }
         )
     )

Unfortunatly its not removing the values from the list in my tests so far.

I also tried moving the code to make use of "oncheck" and "onuncheck"

 

OnCheck

Patch(
              'AcademicChoices', 
               Defaults('AcademicChoices'), 
               {
                  Student: ThisItem.student_x0020_email, 
                  Title: ThisItem.project, 
                  Volunteer: User().FullName
               }
         )

OnUncheck

Remove(
              'AcademicChoices', 
               Defaults('AcademicChoices'), 
               {
                  Student: ThisItem.student_x0020_email, 
                  Title: ThisItem.project, 
                  Volunteer: User().FullName
               }
         )

Again this will add the data to the list happily, but unticking the boxes does not remove the data.

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 (5,217)