Even though I just started learning how to build Powerapps, I have made an pretty good app for registering inventory.
Now I don't like to ask for help every time, I always try to search for solutions myself if I'am stuck at something. This works pretty good, but I can't find an solution for this thing (I don't know what to search for exactly though):
I have an dropdown list where the user can choose an item and than an input box to fill in the amount for that item.
All items are added to an collection called 'InventoryList'. That gallery is directly shown besides the input part.
The current situation is that, if an item already exists in the gallery, the new amount is put in as an seperate item.
I like to have it so that it add up the amount of the item instead of putting everything in as seperate items, even when that same item is already in the gallery.
So basicly, in the current situation: If for example Item1 is already in the gallery, and I add that item again, but whith another amount, I end up with having Item1 two times in the gallery, with two different amounts.
I like to have: If I add Item1 to the gallery, but it already exists, it only add up the amount of that item.
What I have now for the default on the submit button is:
Collect (InventoryList; {Item: I_Item.Selected.Title; Amount: I_Amount.Text; Photo: Filter_dropdown_photo.SelectedText.Value});;
And than I have an gallery showing the items in StockList.
As it is, I'm not writing the records storage location, I just make an collection and than the user can have it send by email at the end of the day, by cliking another button.
Sorry I seemed to have had a typo in the formula before...the disadvantage of free-typing formulas outside of PowerApps.
With({lclItem:LookUp(InventoryList; Item=I_Item.Selected.Title)};
If(IsBlank(lclItem.Item);
Collect(InventoryList;
{Item:I_Item.Selected.Title;
Amount:I_Amount.Text;
Photo: Filter_dropdown_photo.SelectedText.Value}
);
UpdateIf(InventoryList;
Item=lclItem.Item;
{Amount:Value(lclItem.Amount) + Value(I_Amount.Text)})
)
)
(Also added a little value conversion so the addition works properly)
I've double checked the above, but I might still be off on a particular semicolon or parenthesis.
See if that goes for you.
It's just collecting on this single screen, not used on other places. So it's just creating the list on that screen and than I have an option build in to send that list by email.
That almost looks like this is the ONLY place in your app that you are "Collecting" to the InventoryList collection.
Are you using ("Collecting" or "ClearCollecting") the InventoryList collection in another place?
Thanks, but it's trowing a lot of errors for this one, starting with LookUp having wrong arguments, also it doesn't seem to recognize the collection.
Try changing your formula to the following:
With({lclItem:Lookup(InventoryList; Item=I_Item.Selected.Title)};
If(IsBlank(lclItemVal.Item);
Collect(InventoryList;
{Item: I_Item.Selected.Title;
Amount: I_Amount.Text;
Photo: Filter_dropdown_photo.SelectedText.Value
}
);
UpdateIf(InventoryList;
Item=lclItem.Item;
{Amount: lclItem.Amount + Value(I_Amount.Text)}
)
)
This will update an existing record if it is there.
I hope this is helpful for you.
WarrenBelz
58
Most Valuable Professional
mmbr1606
41
Super User 2025 Season 1
MS.Ragavendar
36