I have a Gallery which Items property is a collection. Each collection item is represented in a Textbox:
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.
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
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.
Thanks @StalinPonnusamy , but there is no Unique ID. Actually, some of the rows just differ in a couple of cell.
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
}
)
)
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
WarrenBelz
78
Most Valuable Professional
MS.Ragavendar
49
mmbr1606
41
Super User 2025 Season 1