I am using power app for teams.
Want to update the stockQty of the table as according to for the user item selected in gallery based on PartNumber.
Below is the code which I am using to posting the stockQty of a table, beyond the correct column name it is giving an error.
Could not understand the mistake. Please guide to the correction
below is the table name and column name which i am trying to use
===================================
Later I tried below method also which Also has error :
Sir,
After a small of adding } change it worked. Thank you so much.
Below is the final code which worked
I am testing the code, will post result soon.
In the mean time, I wanted to inform you (as shown in image), on the right side of the gallery is selected items, where I added a text field (blue background), so against each item after selection, user can change the required quantity, else it will remain 1. This field can be referred directly by its name while patching. So I mentioned Value(CartQty.Value)
@MIA27 ,
Firstly, I amended the code a little while after I initially posted - please see the amended item, however I think the problem is elsewhere.
You do not need to rename the column - your can specify it with either ThisRecord.PartNumber or use the As operator where I have used _Data as the identifier. I am a little confused as to why CartQty is not in the gallery as you would be deducting the same amount off every record. The problem here is that the structure is correct and you should not be getting errors if all your references are posted correctly.
The below is just your for your reference to your query for name and its error.
But in my earlier reply, kindly find my test result on your advised code,
Also please find the screen shot of the previous applied code, in the below image you can note the table name
Both the error which I keep mouse on the table name gives as below
and if I keep on the below inside the patch on the table name its below error
Confused why it is not picking the table name , what it is expecting.
But strange, if i keep the Lookup field alone, like below no error:
This proves that with method with lookup has some issue
pls. guide, As I need to understand and then apply the stock updating code.
The reference of the table is correct, I mean the table name, I rechecked its is correct in the code.
I tried to apply the code and got the below error:
Then tried to correct the code for which I have mentioned the reason below, Pls. refer to my first post, where I have rename the columns to avoid conflict:
Still the same error as shown below:
Please guide
Hi @MIA27 ,
Try this
ForAll(
GalleryCartOrder.AllItems As _Data,
With(
{
_Record:
LookUp(
PartsIDtable,
PartNumber = _Data.cartedPartNumber
)
},
Patch(
PartsIDtable,
_Record,
{StockQty: _Record.StockQty - Value(_Data.CartQty.Value)
)
)
)
If that does not work, what does the error say (it seems to be based on PartsIDtable - are you sure it is not PartsIDTable ?)
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.
MVP (Business Applications) Visit my blog Practical Power Apps
WarrenBelz
637
Most Valuable Professional
stampcoin
570
Super User 2025 Season 2
Power Apps 1919
473