Hi everyone,
I got a problem with the Patch-function.
What I have:
A collection (ShoppingCart) with multiple items and a quantity for each item. E.g. "Snickers" "5" and "CocaCola" "2".
A sharepoint list (Inventory) containing each item and a column "InStock" which represents the amount of the item in stock. E.g. "Snickers" and "1000".
What it needs to do:
Upon clicking a button, it needs to patch (substract) the right "InStock" column of "Inventory" with the amount bought. E.g. for ProductName = "Snickers": InStock: 1000-5
My (not working) idea:
ForAll(ShoppingCart; Patch(Inventory;LookUp(Inventory;ProductName = ShoppingCart.Artikel); {InStock: InStock - ShoppingCart.Menge.Value}))
In my imagination, it checks for every item of the shopping cart, if it matches with an item of the "Inventory" Sharepoint list. In that case, it patches the column "InStock" of the Inventory-list with substracting the amount of the item in the shopping cart ("ShoppingCart.Menge.Value").
It does not work at all and I'm sure it has to do with the formula/syntax.
By the way: I'm from germany. For some reason, our syntax has ";" instead of ",".
Thank you very much in advance!