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 / Using ForAll to create...
Power Apps
Answered

Using ForAll to create multiple Collections

(0) ShareShare
ReportReport
Posted on by 43

Good evening!

 

I have an idea that I'd like to implement, but I've been trying to figure how to do it.

 

I have an app that runs without a connection using collections and the save/load data functions. To save space, I want the user to choose which of the larger datasets they pull in so I don't eat up a bunch of space needlessly on their devices.

 

I have a gallery with 10 items manually listed in the items property and check boxes on each item. I added a button beneath so that when the user selects everything they want to retain for offline use, they can download all the data at once. Each item has it's own table in a SQL database that I would like to pull into separate collections, if checked. 

 

Say I have multiple items checked, how do I create multiple collections and fill them from multiple sources?

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    154,889 Most Valuable Professional on at

    Hi @Rob_LVT ,

    Good Afternoon (Saturday 12:30) here.

    The approach I would recommend is to run each off the OnChange of the CheckBoxes and LoadData into a Collection as it is checked. If unchecked, you could clear the collection.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

     

     

  • Verified answer
    v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @Rob_LVT :

    Do you want to update multiple collections with multiple data sources through the check box in the gallery?

    First of all, thanks for @WarrenBelz 's solution.

    Secondly,my solution uses nested If and swith functions,I've made a test for your reference:

    My data source:

    'List A' (SharePoint List)

    'List B'(SharePoint List)

    '[dbo].[Table_2]'(SQL Sever Table)

    1\Add a gallerycontrol

    Items:

     

    ["List A","List B","[dbo].[Table_2]"] /*Use the table composed of data source names as the data source of the gallery*/

     

    2\Add a check box control(Checkbox2) into this gallery

    OnSelect:

     

    If(
     Checkbox2.Value, /*Determine the status of the current checkbox*/
     Switch( /*Determine the currently selected record*/
     ThisItem.Value, 
     "List A",
     ClearCollect( /*Update collection,collection1/2/3 is my custom collection*/
     collection1, 
     'List A'
     ),
     "List B",
     ClearCollect(
     collection2,
     'List B'
     ),
     "[dbo].[Table_2]",
     ClearCollect(
     collection3,
     '[dbo].[Table_2]'
     )
     ), Switch( /*if Checkbox2.Value is false, then clear the specific collection*/
     ThisItem.Value,
     "List A",
     Clear(
     collection1
     ),
     "List B",
     Clear(
     collection2
     ),
     "[dbo].[Table_2]",
     Clear(
     collection3)
     )
    )

     

    1.jpg

    Best Regards,

    Bof

     

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 547

#2
WarrenBelz Profile Picture

WarrenBelz 444 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 322

Last 30 days Overall leaderboard