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 / Powerapps Inventory Ad...
Power Apps
Unanswered

Powerapps Inventory Add Subtract Function not working.

(0) ShareShare
ReportReport
Posted on by 350

Here's the code I'm using. Nothing seems to work. Instead of adding and subtracting the inventory it only inserts the number in my text box.  Instead if should add or subtract from the inventory.  Any help is much appreciated.  

Patch(
tblOptrackInventoryImportedDataCSVS,
LookUp (
tblOptrackInventoryImportedDataCSVS,
FORM_NO = ddl_Form_No.Selected.Value && WAREHOUSE = ddl_From_Warehouse.Selected.Value
),
{ON_HAND: Value("ON_HAND") - Value(txtQuantity.Text)}
);

Categories:
I have the same question (0)
  • rpersad Profile Picture
    776 on at

    You can remove .Text after txtQuantity given that you are using the Value() function. If this makes no changes try putting the subtraction equation in brackets.

    {ON_HAND: (Value("ON_HAND") - Value(txtQuantity))}

     

  • rroque Profile Picture
    350 on at

    No change it throws an error whenI take the text off.

  • rroque Profile Picture
    350 on at

    Forgot. Thanks 

  • rpersad Profile Picture
    776 on at

    Were you able to solve the issue?

  • rroque Profile Picture
    350 on at

    No I have not resolved. No matter what syntaxt I try nothing works.

     

  • rroque Profile Picture
    350 on at

    My equation is in brackets

  • Verified answer
    LaurensM Profile Picture
    12,516 Moderator on at

    Hi @rroque,

     

    Value("ON_HAND") does not refer to the value in that column but rather performs the Value() function on the text value 'On_HAND'. When you want to add / subtract a value from the current state in your table, you can combine the With() and LookUp() functions for easy reference to that current column value. 

     

    With(
     {
     //Temp save LookUp value to a function variable for easy reference in the Patch and for the ON_HAND value
     wLookUp: LookUp(
     tblOptrackInventoryImportedDataCSVS,
     FORM_NO = ddl_Form_No.Selected.Value && WAREHOUSE = ddl_From_Warehouse.Selected.Value
     )
     },
     Patch(
     tblOptrackInventoryImportedDataCSVS,
     //Use function variable as record reference
     wLookUp,
     //Use function variable to reference the current ON_HAND column
     {ON_HAND: wLookUp.'ON_HAND' - Value(txtQuantity.Text)}
     )
    )

     

    If this solves your question, would you be so kind as to accept it as a solution & give it a thumbs up.

    Thanks!

  • Verified answer
    rroque Profile Picture
    350 on at

    That worked fine.  Thank you so much brother.  

  • rroque Profile Picture
    350 on at

    So this inventory portal I'm developing has to add the inventory to warehouse and subtract from warehouse.  

    One of the warehouse is used to replenish inventory.  Here's my code I'm wondering if we can combine or shorten the code a bit.  

    I deduct the from warehouse and add to warehouse.

     

    With(
    {
    //Temp save LookUp value to a function variable for easy reference in the Patch and for the ON_HAND value
    wLookUp: LookUp(
    tblOptrackInventoryImportedDataCSVS,
    FORM_NO = ddl_Form_No.Selected.Value && WAREHOUSE = ddl_From_Warehouse.Selected.Value
    )
    },
    Patch(
    tblOptrackInventoryImportedDataCSVS,
    //Use function variable as record reference
    wLookUp,
    //Use function variable to reference the current ON_HAND column
    {ON_HAND: wLookUp.ON_HAND - Value(txtQuantity.Text)}
    )
    );
    With(
    {
    //Temp save LookUp value to a function variable for easy reference in the Patch and for the ON_HAND value
    wLookUp: LookUp(
    tblOptrackInventoryImportedDataCSVS,
    FORM_NO = ddl_Form_No.Selected.Value && WAREHOUSE = ddl_To_Warehouse.Selected.Value
    )
    },
    Patch(
    tblOptrackInventoryImportedDataCSVS,
    //Use function variable as record reference
    wLookUp,
    //Use function variable to reference the current ON_HAND column
    {ON_HAND: wLookUp.ON_HAND + Value(txtQuantity.Text)}
    )
    )

  • rroque Profile Picture
    350 on at

    And more importantly is there a good manual out there that I can buy or download?

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 793 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 333 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard