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 / Loop through Gallery w...
Power Apps
Answered

Loop through Gallery with textboxes and save it item in collection

(2) ShareShare
ReportReport
Posted on by 578

I have a Gallery which Items property is a collection. Each collection item is represented in a Textbox:

Gallery.jpg

Then there are a couple textboxes that are empty by default, and will only be filled later, and other textboxes may be updated. I need to loop through the entire Gallery, ClearCollect the original collection, and recreated with the new textboxes in the collection. I created a button, and OnSelect I added:

 

ClearCollect(
 ExcellData, //Collection I'm using
 ForAll(
 ImpactSummaryFields.AllItems As Items, //This is the Gallery
 {
 State: Items.StateField.Text,
 County: Items.CountyField.Text,
 FIP: Items.FIPSField.Text,
 MFN: Items.MapFileNameField.Text,
 Crop: Items.CropField.Text,
 SubCounty: Items.SubCountyField.Text,
 CurrentAcres: Items.CurrentAcresField.Text,
 ProposedAcres: Items.ProposedAcresField.Text,
 Percent: Items.PercentageCounty.Text,
 CurrentFSN: Items.CurrentNoFSN.Text,
 ProposedFSN: Items.ProposedNoFSN.Text,
 ChangedFSN: Items.ChangeNoFSN.Text,
 CurrentRate: Items.CurrentRate.Text,
 ProposedRate: Items.ProposedRate.Text,
 }
 )
);

When I click on the button the updates are not added, and some of the rows are removed. What am I doing wrong? Is this even possible?

 

Thanks.

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

    Hi @emfuentes27 ,

    Assuming you want all the fields in the Gallery

    ClearCollect(
     ExcellData,
     ImpactSummaryFields.AllItems
    )

     

    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.

    Visit my blog Practical Power Apps

  • StalinPonnusamy Profile Picture
    Super User 2024 Season 1 on at

    Hi @emfuentes27 

     

    I assume you have a Unique ID that represents each row. In my example, I have ID and renaming for name conflict.

     

    ForAll(
     RenameColumns(
     ImpactSummaryFields.AllItems,
     "ID",
     "NewID"
     ),
     Patch(
     ExcellData,
     {
     ID: NewID,
     State: StateField.Text,
     County: CountyField.Text
    //Other fields
     }
     )
    )

     

  • emfuentes27 Profile Picture
    578 on at

    Thanks @StalinPonnusamy , but there is no Unique ID. Actually, some of the rows just differ in a couple of cell. 

  • emfuentes27 Profile Picture
    578 on at

    Thanks @WarrenBelz , but, how do I define whick each of the properties? E.g. State, County, etc. I intend to reuse the data, so I need it we'll defined.

  • Verified answer
    WarrenBelz Profile Picture
    155,283 Most Valuable Professional on at

    @emfuentes27 ,

    You do not need to - all the gallery fields will be collected and available for reference.

     

    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.

    Visit my blog Practical Power Apps

     

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 April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 1,009

#2
11manish Profile Picture

11manish 672

#3
Valantis Profile Picture

Valantis 628

Last 30 days Overall leaderboard