cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
cdowkes
Frequent Visitor

Update all records

Hi. 

 

I'm still very new to PowerApps and trying to learn as I go. I'm trying to make my shopping cart app work with a stock list. I have the app set up so the items to order and the stock available are separate lists. This is because separate companies within our group order items from the stock list but they don't have access to the same items so easier to make one stock list and several apps where they can only order the items they are allowed. 

 

Anyway I have the app set up to show the stock figures for each item which works great. The next thing I want to do is update the stock figures for each item as they are ordered. I thought I had this working but then noticed that it only updates the first item ordered. 

The button to run the code is outside of the gallery so all items should be updated on the order button. 

 

I was comparing the title and if that matched this item I would then update the quantity with the label from the gallery. 

The code I am using for this is 

 

Patch('PPE Stock', LookUp('PPE Stock', Title = Gallery2.Selected.Title), {field_1: Label9.Text})

 

 I then tried to use a collection to see if this would work but I can't get it to show the quantity correctly as I just get a table in my collection. 

 

Collect(colstockdeductions, AddColumns(colShoppingCart, "OrderDeduction", Gallery2.Selected.Label9));
ForAll(colstockdeductions,Patch('PPE Stock', LookUp('PPE Stock', Title = Gallery2.Selected.Title), {field_1: Label9.Text}));

 

Any help with this would be much appreciated I feel like I'm so close to having this done other than this last little bit. 

1 ACCEPTED SOLUTION

Accepted Solutions
v-bofeng-msft
Community Support
Community Support

Hi  @cdowkes ,

 

Please try:

ForAll(
  Gallery2.AllItems As TableA, 
  Patch(
     'PPE Stock', 
      LookUp('PPE Stock', Title = TableA.Title), 
      {field_1: TableA.Label9.Text}
  )
)

 

Best Regards,

Bof

View solution in original post

2 REPLIES 2
v-bofeng-msft
Community Support
Community Support

Hi  @cdowkes ,

 

Please try:

ForAll(
  Gallery2.AllItems As TableA, 
  Patch(
     'PPE Stock', 
      LookUp('PPE Stock', Title = TableA.Title), 
      {field_1: TableA.Label9.Text}
  )
)

 

Best Regards,

Bof

Perfect! Thank you so much for that it's worked brilliantly. 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,512)