
Announcements
Hello everyone, I am fairly new to Power Apps.
I want to select one or more elements in a combobox, show them in a gallery and eventually add to each selected item some information in a text input and then patch the new information in a new record pro item (Value and manually added quantities).
on the left the combobox, on the right the gallery
The combobox is based on a "choices" column from my table table:
Items = Choices('Table'[@ChoicesColumn])
if there is a change, it will collect the chosen values in the (cmb = combobox) in a collection:
OnChange = ClearCollect(
Collection;
cmb.SelectedItems.Value
)
This is how the Collection looks like: empty, only the "Value" Column has the collected values:
My gallery shows the collection of selected values:
Items = Collection
And pairs each item with an numerical text input field (for quantity).
Label = ThisItem.Value
TextInput
Now I wanna Patch those value and quantity in a SharePoint List "Table" (not in the Collection): for each item in the gallery, read the Value and the Quantity and patch it as a new record. Since I wanna patch also a choices column, I will use the special synthax
Column: {Value: Label.Text}
In my "patch" button:
OnSelect = ForAll(
Gallery1.AllItems;
Patch(
'Table';
Defaults('Table');
{
Quantity: Value(txtInput.Text);
Value: {Value: Label.Text}
}
)
);;
It keeps adding for each item in the gallery + 1 a record in Table (if there are 3 items, I will get 4 records), every record with the same value and quantity (4 records, every one with the selected value and quantity, lets say A and 1 instead of: A, 1; B,2; C3).
What am I doing wrong? Is there another solution to get what I want? Thank you!
@WarrenBelz @LaurensM @SpongYe @ANB @M_Ali_SZ365
Hi @RPowerAutomated,
What exactly do you want to achieve?
Based on your formula, the Patch() will save 3 records to your list, with two column, one is Value and another is Quantity.
Your list should be like below:
| Value | Quantity |
| A | 1 |
| B | 1 |
| C | 1 |