cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ramole
Post Prodigy
Post Prodigy

Update quantity

Hi,

 

I would to update / patch Inventory quantity field using ForAll  when submitting data, but at moment i am using a single record, but i would like to update all items in the gallery in collection and update each quantity field please help,  here the formula i am using at moment.

UpdateIf(
    ProductServiceList,
    Title = Gallery5.Selected.SKU,
    {'Quantity On Hand': 'Quantity On Hand'   -  Value(DDAmountCart.Selected.Value)}
)

 

 

 

Thanks 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also close the item., please consider giving it Thumbs Up.
2 ACCEPTED SOLUTIONS

Accepted Solutions

@Ramole ,

See what you are doing different here - I even named all the elements the same

UpdateGalleryNos.jpg

UpdateGallery.gif

 

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.

 

View solution in original post

@fugixi ,

I have found the Patch "lining up" columns unreliable if you have matching columns (but the columns do not match here ) so a ForAll() should be an easier solution. Also your Patch syntax should be

Patch(
    CartList,
    {Title:ThisItem.SKU},
    {'Quantity On Hand': 'Quantity On Hand' - Value(DDAmountCart.Selected.Value)}
)

 

View solution in original post

17 REPLIES 17
WarrenBelz
Super User III
Super User III

@Ramole ,

Assuming you have a field in a collection patched when you change the dd

ForAll(
   GalleryName.AllItems As aGall,
   Patch(
      ProductServiceList,
      {ID:aGall.ID},
      {'Quantity On Hand': 'Quantity On Hand'- aGall.DDCartFieldName}
   )
)

The ID can be any unique record identifier.

 

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.

Hi @WarrenBelz 

 

I am getting error on 'Quantity On Hand', see the screenshot please, @WarrenBelz i update quantity when submitting the data at end Not onChange  

Capturejjj.PNGCapturejj.PNG

 

 

 

 

 


Thanks 

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also close the item., please consider giving it Thumbs Up.

@Ramole ,

Try this

ForAll(
   Gallery5.AllItems As aGall,
   Patch(
      ProductServiceList,
      {Title:aGall.SKU},
      { 
         'Quantity On Hand': aGall.'Quantity On Hand' -  
         Value(aGall.DDAmountCart.Selected.Value)
      }
   )
)

 

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.

 

Hi @WarrenBelz 

 

Still same error, let explain what i am doing is i collect items from a list called product to cartlist collection then after that i would like CartList collection to submit but before i do that i want to deduct all the quantities in cartlist from product list, here the formula for my collection.

 

 

 

Collect(
    CartList,
    {
        ID: Concatenate(
            Text(
                Now(),
                "[$-en-US]mm/dd/yyyy hh:mm:ss"
            ),
            First(ProductInfoCollection).Title,
            Text(DDAmount.Selected.Value)
        ),
        Name: First(ProductInfoCollection).'Sales Description',
        SKU: First(ProductInfoCollection).Title,
        Amount: DDAmount.Selected.Value,
        Price: First(ProductInfoCollection).'Sales Price / Rate',
        CATEGORY: First(ProductInfoCollection).CATEGORY,
        Image: First(ProductInfoCollection).ImageLink,
        Qty: First(ProductInfoCollection).'Quantity On Hand',
        Total: (DDAmount.Selected.Value * First(ProductInfoCollection).'Sales Price / Rate')
    }
);
UpdateContext({ResetDDAmount: true});
UpdateContext({ResetDDAmount: false});
Navigate(Home);

 

 

Thanks 

 

 

 

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also close the item., please consider giving it Thumbs Up.

@Ramole ,

I have that syntax working on a test list here (hence the enhancement when I was able to test it properly).

Your current post is another subject entirely - can we please stick to the posted subject and apply the values as they relate to your model.

Hi @WarrenBelz 

the post is before adding to collections to check the how many quantities available or else disable if the input more than availability’

thanks 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also close the item., please consider giving it Thumbs Up.

@Ramole ,

What error are you getting on your code - please also post it in Text.

Hi @WarrenBelz 

Same error 'Quantity On Hand'  not exist 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also close the item., please consider giving it Thumbs Up.

@Ramole ,

Please post your code as Text as requested - I have the syntax working perfectly here.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (44,448)