web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / CheckAll to add to a C...
Power Apps
Unanswered

CheckAll to add to a Collection is adding table records instead of lines

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I have a named Gallery2 and a collection named Step1_Collection.

Each Gallery2 item has a checkbox (checkbox1) where OnCheck adds the gallery item to Step1_Collection. When the lines are added to Step1_Collection, the ThisItem fields are added, plus additional columns:

checkbox1 OnCheck :

 

 

 

 

Collect(Step1_Collection,AddColumns(Table(
{
column1 : ThisItem.column1,
column2: First(ThisItem.test).column2}),


"column3", Left(Dropdown_column3.SelectedText.Value,4),

"column4", Value(column4.Text),
"column5", Value(column5.Text),

"column6", Dropdown_column6.SelectedText.Value,
"column7", Dropdown_column7.SelectedText.Value,
"column8", Dropdown_column8.SelectedText.Value,
"column9", Dropdown_column9.SelectedText.Value,
"column10", Dropdown_column10.SelectedText.Value,
"column11", Dropdown_column11.SelectedText.Value,

"column12", TextInput_column12.Text,
"column13", Value(TextInput_column13.Text),
"column14", Value(TextInput_column14.Text),
"column15", TextInput_column15.Text,
"column16", Value(TextInput_column16.Text),
"column17", Value(TextInput_column17.Text),
"column18", Value(TextInput_column18.Text),
"column19", Value(TextInput_column19.Text)
))

 

 

 

 




I also have a checkbox (Checkbox2) that sits outside of Gallery2 that serves as a CheckAll option for all checkboxes in Gallery2. I used the solution found in this post. 

 

Checkbox2 OnCheck:
 

 

 

 

 

UpdateContext({CheckCheckbox:true});ForAll(Collect(Step1_Collection,Gallery2.AllItems),ThisRecord)

 

 

 

 



Checkbox2 OnCheck is working correctly in the sense that the information is being added to the collection when checking all the boxes at once, however, instead of adding individual lines as items, it is adding a table of records per line (I am probably describing this using the wrong terminology, so below is a picture):
Step1_Collection Example 1.PNG

 

How do I get the CheckAll option to collect all data as singular lines without tables that need to be expanded?

 

P.S.  I did see some replies on the referenced post where people were saying to not use collections since a gallery is like a collection, but I am collecting this information to send as a JSON file to Power Automate, so a collection is actually needed.

Categories:
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    First, skip the advice you got in that post you referenced...it's so much more work than you need!

     

    Instead, set the Default of your Checkbox in the Gallery to: Checkbox2.Value

     

    And now...YES, you have probably read many of my posts about not wasting your time with the collection.  You only need a basic base collection for the gallery to actually have rows.  But consider it your input to the gallery.  The Gallery itself is the output...that is what you would use.  

     

    You don't need a collection for your JSON for PowerAutomate.  Not sure why you would think you would, but if there is a specific reason...please expand on that.

     

    Your final formula for your PowerAutomate flow call would be:

    yourFlow.Run(
     JSON(
     ForAll(Filter(Gallery2.AllItems, checkbox1.Value), 
     {column1: yourInputControlForColumn1.Text,
     column2: yourInputControlForColumn2.Text,
     column3: Left(Dropdown_column3.Selected.Value,4), //don't use SelectedText!!
     column4, Value(column4Input.Text),
     ...etc..
     }
     )
     )
    )
    

     

    I hope this is helpful for you. 

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I am going to try a non-collection option, as you suggested. The set up and sourcing of my data is a bit complex with how it relates to each other but it's worth a try. If successful, I'll come back and mark your response as a valid solution.

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    Well, it's not really a "non-collection" method.  You do still need a table of items as the base to your gallery - that could be a collection or a general table.  But that is it.  Do all the rest of the data manipulation (either manually via user or automatically via formula) in the gallery controls.  Then reference the gallery and its controls to derive everything else.

     

    Make sure you always use the ForAll properly (as a table function) not at a for loop (it's not).

     

    Also, keep in mind that the only difference between a general table and a collection is that the collection has the ability to have records added, removed or edited - it is still a table!  If you don't need to do those functions, then only a table is needed.  You don't need the extra overhead.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 234 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 207 Most Valuable Professional

#3
timl Profile Picture

timl 122 Super User 2026 Season 2

Last 30 days Overall leaderboard