The following attempts to subtract or add inventory. I have an ON_HAND function that subtracts from one warehouse and adds the
inventory to the second warehouse. Instead it does something strange. The function below adds the number 1 to the on hand inventory. Say I have 100 forms on hand. But I want to transfer 200 below the error pops up informing the user that it cannot transfer due to insufficient available on hond. Instead it adds a number 1, yes number 1 to the available on hand.
Below is the function I'm using.
Any help is much appreciated.
UpdateContext({isVisible:false});
With(
{
wLookUp: LookUp(
OPTrack_FormsInventoryEnhancedTables,
FORM_NO = ddl_Form_No.Selected.Value && WAREHOUSE = ddl_From_Warehouse.Selected.Value
)
},
Patch(
OPTrack_FormsInventoryEnhancedTables,
wLookUp,
{
ON_HAND: If(wLookUp.'ON_HAND' < Value(txtQuantity_6.Text), UpdateContext({isVisible:true}), wLookUp.'ON_HAND' - Value(txtQuantity_6.Text))
}
)
);
With(
{
wLookUp: LookUp(
OPTrack_FormsInventoryEnhancedTables,
FORM_NO = ddl_Form_No.Selected.Value && WAREHOUSE = ddl_To_Warehouse.Selected.Value
)
},
Patch(
OPTrack_FormsInventoryEnhancedTables,
wLookUp,
{
ON_HAND: If(wLookUp.'ON_HAND' < Value(txtQuantity_6.Text), UpdateContext({isVisible:true}), wLookUp.'ON_HAND' + Value(txtQuantity_6.Text))
}
)
);