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

Checkboxes

I have a gallery page in PowerApps with 17 names and corresponding checkbox. Upon inspection of these names i want to tick the box and return the values to a 2nd SharePoint list. How do I go about that? Would the patch function work?
1 ACCEPTED SOLUTION

Accepted Solutions
Eelman
Level 8

Re: Checkboxes

@nmagee Ah, the penny is finally dropping for me as to how your data is setup in SP. I had a go at creating the Patch function (there was also some other setup code that was needed as well) but I ran into this issue and can't go any further:

https://powerusers.microsoft.com/t5/Building-Power-Apps-Formerly/Patch-Referance-a-column-name-via-a...

 

Is the SP List A ONLY used to create the Gallery items? If so, I'd like to propose a different solution that doesn't use that list but uses a Form instead.

 

I assume all columns, except for 'Sales Member', are Yes/No columns in SP?

My solution:

1. On your 'Submit' screen, select your gallery and hit delete

2. Select Insert --> Forms --> Edit

  2.1 In the LH panel Rename the Form to "frmStallionViewings"

3. With the Form selected, in the RHS panel, choose your 'Data Source' ie 'Stallion Viewings'. This will bring into the form all the columns from your SP List

4. In the RH panel, change 'Columns' to 1

5. In your Form, scroll to the bottom and select attachments DataCard and hit delete

6. 'Sales Member' will show inside the form, so you can remove the 'enter email address' at the top of your screen and use this field for that (I've assumed that's the data getting collected in the column 'Sales Member'?)

7. Each Yes/No column will show as a Toggle rather than a checkbox. You can leave this as is or change to checkboxes. I show you how below.

8. If you want to leave as Toggles but want the toggle to display to the right of the name and also say Yes/No do the following for each DataCard:

  8.1 Select 'Australia' datacard

  8.2 In the RH panel select 'Advanced' then click 'Unlock to change properties'

  8.3 Select the label 'Australia' (make sure you still have the datacard selected)

  8.4 Resize it to allow some space on the RHS. Do any relevant formatting now eg text color/size

  8.5 Select the Toggle and drag it to the RHS of the label. Do any relevant formatting now eg text color/size

  8.6 With the Toggle still selected change the TrueText property to "Yes" and the FalseText property to "No"

  8.7 Repeat for all DataCards

9. Set the OnSelect property of your 'Submit' button to: SubmitForm(frmStallionViewings)

Users can then enter their email address, select Yes/No for the relevant toggles, then click Submit.

Note: If you want all toggles to display as "No" as default change your SP List columns to default as "No"

 

BONUS section 🙂 - Remove Toggles / Add Checkboxes

1. Follow all steps above but replace Step 8 with the following

2. Remove toggles / Add checkboxes

  8.1 Select 'Australia' datacard

  8.2 In the RH panel select 'Advanced' then click 'Unlock to change properties'

  8.3 Select the label 'Australia' (make sure you still have the datacard selected)

  8.4 Resize it to allow some space on the RHS. Do any relevant formatting now eg text color/size

  8.5 Select the Toggle and hit delete. 2 warnings/errors popup but don't worry we will fix those

  8.6 With the datacard still selected on the INSERT tab select Input --> Checkbox

  8.7 With the new checkbox still selected delete the text from the Text property (it should say "Option", just remove it)

  8.8 Resize your checkbox and move it to the RHS of the Australia label. Do any relevant formatting now eg text color/size

  8.9 With the cbox still selected, in the LH panel, rename it to something relevant eg "cboxAustralia". Change this for each datacard

  8.9 Select the datacard and change it's Update property to cboxAustralia.Value

  8.10 With the datacard still selected, select the 'Error Message' in the LH panel. Change it's Y property to cboxAustralia.Y + cboxAustralia.Height 

  8.11 The 2 errors should now be sorted

  8.12 Repeat for all DataCards

 

Apologies for the extra long post but hopefully this sets you straight. If this works you won't need to maintain the SP List A, unless it's used for other things. 

 

Also, the formatting of Forms is very clunky and limited but if you are OK with the basic appearance then it shouldn't be an issue.

 

Hopefully this gets it sorted for you!

 

 

View solution in original post

11 REPLIES 11
Eelman
Level 8

Re: Checkboxes

@nmagee can you share a bit more about your app? Are the checkboxes inside your gallery? Can you share a pic?

 

if they are inside your gallery you can, OnCheck of each checkbox, collect that gallery item into a collection. When the person is done you can Patch that collection to your second SP List.

 

It also good design to setup the OnUnCheck to Remove() and item from the collection before patch.

 

hope this makes sense?

nmagee
Level: Powered On

Re: Checkboxes

Hi @Eelman ,

many thanks for the comments. I have attached two screenshots. 1 is of the proposed layout of the list I want to post to. Will this work do you think? 

thanks a million 

 

Neil

nmagee
Level: Powered On

Re: Checkboxes

43AC6517-7DDC-4C1D-8985-D8284B1734AA.pngF657A546-F985-47ED-A9C5-351911E8BBA2.png

Eelman
Level 8

Re: Checkboxes

Yep, should do. 

 

So, will a user be creating a new item or editing an existing one? If editing, my thoughts would be to pull the required record into a local collection using SP ID column filter. Then using UpdateIF() and RemoveIf() on your check boxes to edit the record locally in the app, then on SUBMIT patch this collection back to the SP List.

 

If creating a new item, the check boxes true/false state can be referenced in a patch function back to SP.

nmagee
Level: Powered On

Re: Checkboxes

@Eelman, the users will be creating a new entry each time. Can you provide me with the required patch statement I would need to allow the flow to the sharepoint list bearing in mind that the items listed in the gallery are from list A and not the list that I screenshot.
Eelman
Level 8

Re: Checkboxes

@nmagee Ah, the penny is finally dropping for me as to how your data is setup in SP. I had a go at creating the Patch function (there was also some other setup code that was needed as well) but I ran into this issue and can't go any further:

https://powerusers.microsoft.com/t5/Building-Power-Apps-Formerly/Patch-Referance-a-column-name-via-a...

 

Is the SP List A ONLY used to create the Gallery items? If so, I'd like to propose a different solution that doesn't use that list but uses a Form instead.

 

I assume all columns, except for 'Sales Member', are Yes/No columns in SP?

My solution:

1. On your 'Submit' screen, select your gallery and hit delete

2. Select Insert --> Forms --> Edit

  2.1 In the LH panel Rename the Form to "frmStallionViewings"

3. With the Form selected, in the RHS panel, choose your 'Data Source' ie 'Stallion Viewings'. This will bring into the form all the columns from your SP List

4. In the RH panel, change 'Columns' to 1

5. In your Form, scroll to the bottom and select attachments DataCard and hit delete

6. 'Sales Member' will show inside the form, so you can remove the 'enter email address' at the top of your screen and use this field for that (I've assumed that's the data getting collected in the column 'Sales Member'?)

7. Each Yes/No column will show as a Toggle rather than a checkbox. You can leave this as is or change to checkboxes. I show you how below.

8. If you want to leave as Toggles but want the toggle to display to the right of the name and also say Yes/No do the following for each DataCard:

  8.1 Select 'Australia' datacard

  8.2 In the RH panel select 'Advanced' then click 'Unlock to change properties'

  8.3 Select the label 'Australia' (make sure you still have the datacard selected)

  8.4 Resize it to allow some space on the RHS. Do any relevant formatting now eg text color/size

  8.5 Select the Toggle and drag it to the RHS of the label. Do any relevant formatting now eg text color/size

  8.6 With the Toggle still selected change the TrueText property to "Yes" and the FalseText property to "No"

  8.7 Repeat for all DataCards

9. Set the OnSelect property of your 'Submit' button to: SubmitForm(frmStallionViewings)

Users can then enter their email address, select Yes/No for the relevant toggles, then click Submit.

Note: If you want all toggles to display as "No" as default change your SP List columns to default as "No"

 

BONUS section 🙂 - Remove Toggles / Add Checkboxes

1. Follow all steps above but replace Step 8 with the following

2. Remove toggles / Add checkboxes

  8.1 Select 'Australia' datacard

  8.2 In the RH panel select 'Advanced' then click 'Unlock to change properties'

  8.3 Select the label 'Australia' (make sure you still have the datacard selected)

  8.4 Resize it to allow some space on the RHS. Do any relevant formatting now eg text color/size

  8.5 Select the Toggle and hit delete. 2 warnings/errors popup but don't worry we will fix those

  8.6 With the datacard still selected on the INSERT tab select Input --> Checkbox

  8.7 With the new checkbox still selected delete the text from the Text property (it should say "Option", just remove it)

  8.8 Resize your checkbox and move it to the RHS of the Australia label. Do any relevant formatting now eg text color/size

  8.9 With the cbox still selected, in the LH panel, rename it to something relevant eg "cboxAustralia". Change this for each datacard

  8.9 Select the datacard and change it's Update property to cboxAustralia.Value

  8.10 With the datacard still selected, select the 'Error Message' in the LH panel. Change it's Y property to cboxAustralia.Y + cboxAustralia.Height 

  8.11 The 2 errors should now be sorted

  8.12 Repeat for all DataCards

 

Apologies for the extra long post but hopefully this sets you straight. If this works you won't need to maintain the SP List A, unless it's used for other things. 

 

Also, the formatting of Forms is very clunky and limited but if you are OK with the basic appearance then it shouldn't be an issue.

 

Hopefully this gets it sorted for you!

 

 

View solution in original post

Community Support Team
Community Support Team

Re: Checkboxes

Hi @nmagee ,

Could you please share a bit more about your scenario?

Do you want to save these checked names from the Gallery (connects to first SP List) back to your second SP list?

 

Based on the needs that you mentioned, I think the ForAll function and Patch function could achieve your needs. I have made a test on my side, please consider take a try with the following workaround:

Set the OnSelect property of the "Submit" button to following:

ForAll(
       Filter(Gallery1.AllItems, Checkbox1.Value = true),  // Filter Gallery items whose Checkbox has checked
       Patch(
             'Second SP List',
              Defaults('Second SP List'),
              {
                 Title: "xxx",
                 Column1: NameColumn  // NameColumn commes from your Gallery, which stores the 17 names that you mentioned
                 Column2: "xxx",
                 ...
              }
       )
)

 

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.
Eelman
Level 8

Re: Checkboxes

@v-xida-msft  just wanting to understand your code a little better but would this create as many new records in the 2nd SPList as there are ticked checkboxes?

I think @nmagee is only wanting one record from all the ticked checkboxes.

 

Thanks, and apologies if I havent explained myself overly well.

nmagee
Level: Powered On

Re: Checkboxes

@Eelman, thanks very much. It’s working nicely now.
Great job

Helpful resources

Announcements
thirdimage

Power Automate 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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 297 members 5,780 guests
Please welcome our newest community members: