Hi
I am new to glideapps. I have created a form to add records. While adding new records I need to calculate values based on certain conditions. For Example
Stock Master
Item Name
Balance Qty
Price
Stock Issue
Date
Item Name
Issue Qty
Issue Qty should be validated against Balance Qty.
If Issue Qty > Item master->Balance Qty then Message “Enough stock not available”
If Issue Qty < Balance qty then calculate Issue value as Qty * Price in Item master.
You cannot achieve what you want with a native form, since with a native form the data can only be computed after it is submitted, whereas you need to compute it before.
To be clearer on your setup, assuming you’re adding a stock issue in your custom form.
You would need to have 3 user-specific columns to store the date, item name and issue quantity. You might want to store the stock master’s ID instead of its “name”, if I understand you right (Item Name in Stock Issue is linked to Item Name in Stock Master).
Add a relation to relate the stock ID back to the Stock Master table, then two lookups on top of that relation to retrieve the balance quantity and price of the stock in question.
Show the “Enough stock not available” message if the input issue quantity > lookup balance quantity.
Allow submitting through an add row action if issue quantity < balance quantity.
If you don’t need to show this in the same form screen then you can simply add a math column in the destination Stock Issue table with the input quantity and the lookup price.