web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Use Powerapps achieve ...
Power Apps
Unanswered

Use Powerapps achieve add and subtract data in two tables.

(0) ShareShare
ReportReport
Posted on by 96

I have asked this question before, here is the link to my question.

https://powerusers.microsoft.com/t5/Building-Power-Apps/How-to-setup-connection-with-two-data-sources-and-fulfill-the/td-p/557921 

 

I completed the addition and subtraction function I wanted according to the answerer's settings, but I currently have 1000+ row items in my SP database. This function is no longer valid. There is no error reminder, only one warining. As follows.

Dennis_Qiang_0-1597029041557.png

 

ClearCollect(Related_In, DataCardValue18_2.Selected);ClearCollect(Quantity_In, DataCardValue21_2.Text);If("Wait For Confirm" in DataCardValue16.SelectedItems.Value, UpdateContext({show1:true}), SubmitForm(EditForm1_4);
Patch(
 'Facility Warehouse Database',
 LookUp(
 'Facility Warehouse Database',
 'Material ID'.Value = First(Related_In).Value
 ), 
 {
 Qty: LookUp(
 'Facility Warehouse Database',
 'Material ID'.Value = First(Related_In).Value
 ).Qty + First(Quantity_In).Value
 }
);Navigate(In_Check_BrowseScreen_1, ScreenTransition.UnCoverRight))


I actually want to implement an inventory management calculation. SP_list#1 is used as my inventory list. There are 1000+row items in it. Each item has a unique material ID and its own inventory quantity. My SP_list2# is for warehousing submission. When warehousing submit, fill in the material ID to index to the corresponding row in SP_list#1, and then fill in a quantity, which means that SP_list#1 inventory will increase. Is there a way to perform the above calculations for big data sources?

 

Thank you!

Dennis

 

 

 

Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    153,026 Most Valuable Professional on at

    Hi @Dennis_Qiang ,

    I may be guessing a bit here, but you should not need the collections if you are looking for the first selected value (and the text value will always be the first. Try this for a start

    If(
     "Wait For Confirm" in DataCardValue16.SelectedItems.Value, 
     UpdateContext({show1:true}), 
     SubmitForm(EditForm1_4);
     Patch(
     'Facility Warehouse Database',
     LookUp(
     'Facility Warehouse Database',
     'Material ID'.Value = DataCardValue18_2.Selected.Value
     ), 
     {
     Qty: 
     LookUp(
     'Facility Warehouse Database',
     'Material ID'.Value = DataCardValue18_2.Selected.Value
     ).Qty + 
     Value(DataCardValue21_2.Text)
     }
     );
     Navigate(
     In_Check_BrowseScreen_1, 
     ScreenTransition.UnCoverRight
     )
    )

     

    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.

  • Dennis_Qiang Profile Picture
    96 on at

    Hi @WarrenBelz 

     

    I try you method and the SP_list#1 value have changed, but the calculation is wrong. It doesn't work.

     

    Is there any other way to achieve this function?

  • WarrenBelz Profile Picture
    153,026 Most Valuable Professional on at

    @Dennis_Qiang ,

    Can you please explain exactly what you are trying to achieve and what values are in DataCardValue21_2 and DataCardValue18_2

    .

  • Dennis_Qiang Profile Picture
    96 on at

    Hi @WarrenBelz 

     

    Please see the pic below:

     

    list0810.png


    List#1 acts as my database. List#2 acts as my user interface. User input list#2. Choose the Material ID, other information will be call form list#1. And User also need to Input Qty. After user submit the items, List#1 with the same Material ID row which user just choose. List#1_Qty = List#1_Qty + List#2_Qty.


    Looking forward to your answer, thank you

  • WarrenBelz Profile Picture
    153,026 Most Valuable Professional on at

    @Dennis_Qiang ,

    To put it another way, you want to take List 1 item matched on Material ID choice in DataCardValue21_2 and add the existing Qty in that record to the value input by the user in DataCard18_2? If so, try this

    If(
     "Wait For Confirm" in DataCardValue16.SelectedItems.Value, 
     UpdateContext({show1:true}), 
     SubmitForm(EditForm1_4);
     Patch(
     'Facility Warehouse Database',
     {'Material ID':DataCardValue18_2.Selected.Value},
     {Qty: Qty + Value(DataCardValue21_2.Text)}
     );
     Navigate(In_Check_BrowseScreen_1, ScreenTransition.UnCoverRight)
    )

    Also what are you using both SubmitForm and Patch together?

     

    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.

  • Dennis_Qiang Profile Picture
    96 on at

    Hi @WarrenBelz 

     

    I have try you method. But it have some error.

    Dennis_Qiang_0-1597048223412.png

     

     

  • WarrenBelz Profile Picture
    153,026 Most Valuable Professional on at

    @Dennis_Qiang ,

    It appears Material ID might be a record even though you have shown me a table with it as Text - I can only only work with what you provide. Try this

    If(
     "Wait For Confirm" in DataCardValue16.SelectedItems.Value, 
     UpdateContext({show1:true}), 
     SubmitForm(EditForm1_4);
     Patch(
     'Facility Warehouse Database',
     {'Material ID'.Value:DataCardValue18_2.Selected.Value},
     {Qty: Qty + Value(DataCardValue21_2.Text)}
     );
     Navigate(In_Check_BrowseScreen_1, ScreenTransition.UnCoverRight)
    )

     

    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.

  • Dennis_Qiang Profile Picture
    96 on at

    Hi @WarrenBelz 

     

    I change to this and it work. Thank you!

     

    If(
     "Wait For Confirm" in DataCardValue16.SelectedItems.Value, 
     UpdateContext({show1:true}), 
     SubmitForm(EditForm1_4);
     Patch(
     'Facility Warehouse Database',
     First(Filter( 'Facility Warehouse Database', DataCardValue18_2.Selected.Value in 'Material ID'.Value )),
     {Qty: First(Filter( 'Facility Warehouse Database', DataCardValue18_2.Selected.Value in 'Material ID'.Value )).Qty + Value(DataCardValue21_2.Text)}
     );
     Navigate(In_Check_BrowseScreen_1, ScreenTransition.UnCoverRight)
    )

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard