Hi @Bhashb11,
Have you solved your problem?
Do you want to patch based on the stock?
Could you please share more details about the Idealstock and CurrentStock, is that the same?
To achieve your need, please check as below.
1). Question 1 - Cannot we add the patch function with If Function which replaces the Boolean with Patch
Yes, you can. If the SellingQuantity is a Text column and gblProduct.Stock is a number data, please write the Patch() as below:
If(Value(SoldText.Text) < gblProduct.Stock, Patch(Hardware1,gblProduct,{SellingQuantity:CurrentStock.Text-SoldText.Text}),xxxx)
2). To validate the number input within the sold Text input box, you could set the OnChange property of it as below:
If(
Value(SoldText.Text) >= 0 && Value(SoldText.Text) < Value(Idealstock.Text),
Patch(
Hardware1,
{Sold: SoldText.Text}
),// This helps you save the sold data when the sold input is less than the ideal stock
Reset(SoldText) && Notify(
"Please input a number less than the ideal stock",
Error
)//This helps neglect it when the sold input is more than the ideal stock
)
3). To avoid minus values, do you meant that the calculation between the OrderQuantity and CurrentStock? If so, you just need to write formula set for the Onselect property of a button as below:
If(
Value(OrderQuantity.Text+CurrentStock.Text)<0,
Notify("Please note that you should have a positive number!",Error),
Patch(Hardware1, gblProduct,{SellingQuantity:OrderQuantity.Text+CurrentStock.Text}
)