I have a gallery that will take in user input. The gallery has column names that auto populate based on the data source provided, and the number of text inputs varies based on that. When I hit the submit button in our form, I want to store all the text inputs in a collection that corresponds directly to the column name. For example, when I hit submit, the collection should show Operator Initial and then the written input as one row, and then do this for the rest of the rows.
I have struggled with trying to figure out how to store the data. The closest to a solution I have come up with is the following code:
ClearCollect(FormData, {Date: DatePicker1_1, ColumnNames: Gallery1_2.AllItems.Label9_1 , Item: Gallery1_2.AllItems.TextInput4_1, Comments: TextInput3_2});
However, this stores the objects of data, not the actual data (shown below).
My question is this: How do I store the individual items into their rows directly from a single button. I apologize if there's an obvious answer I'm missing, as I'm still really new to the Power Apps Platform.
Thanks for the reply. I definitely misunderstood that a gallery was already a table, and realizing that helped me better figure out how I want to handle this data. The formula was exactly what I was looking for, so thank you so much for that guidance.
@Anonymous
Your Gallery already is a collection/table of values. Duplicating in a collection is not seemingly relevant to where you are trying to go.
So, if we skip the collection, where exactly are you going with the data?
Also, specifically to what you are seeing, you are referencing the objects/controls in your Gallery, not the values. So, Label9_1 is a control...Label9_1.Text is the text value that you want.
The reason I ask about where you are going with this is because it almost seems like you are planning to then update specific columns in your datasource based on those names - perhaps dynamically - which will not work.
Possibly that is not where you are going, but I wanted to save you the grief of trying to figure out what issue you have now only to find you'll have a bigger issue later.
I hope this is helpful for you.
EDIT: Oh, and if you want a table with the single values, then this is the formula:
ForAll(Gallery1_2.AllItems,
{Date: DatePicker1_1.SelectedDate,
ColumnName: Label9_1.Text,
Item: TextInput4_1.Text,
Comments: TextInput3_2.Text
}
);
WarrenBelz
637
Most Valuable Professional
stampcoin
570
Super User 2025 Season 2
Power Apps 1919
473