I suggest you user global fields in your custom dialog to capture the user data. Then in your script you can append to your current field by using a set field.
Set Field [ Field; Field & gUserEntry ]
You can add a pilcrow if you want a carriage return between values.
Set Field [ Field; Field & ¶ & gUserEntry ]
Or, in this case, use the script to add/subtract the values.
On a side note, Inventory tracking seems to be a recurring theme, and most people try to solve it in the same way, by manually incrementing/decrementing the quantities in stock. It's almost always better to use an Inventory Log table to track quantities added to, or removed from Inventory, and then use this table to update the total quantity available. Just my 2¢.
To expand on Etripoli's suggestion...
Think of your inventory log as a check register, but instead of logging deposits and withdrawals of $$, you are adding and removing items from inventory. Your log not only gives you current inventory counts, it also gives you a history of how your inventory levels have changed over time and this can be a valuable management tool for adjusting restocking points and other such details.
First of all, I am really sorry for the late reply guys, but I was offline whole say yesterday.
@ MR. Vodka --> As you said, I tried saving values in a global variable and the method worked. Thankyou very much for that .
@ Etripoli and Phil--> Guys, I understood that the concept of keeping a log would help me but how can I make a log file? I mean should I store old value of the variable somewhere whenever it is updated?
You set your log up in a table where each record documents the change in inventory for a specified item and use summary fields to compute total amount on hand.
You'd have fields such as:
Date, Material ID, Amount added, Amount removed, cBal (Amount added - Amount removed), sBalance (Summary, total of cBal or possibly a running total of cBal)
Each time you log a change, you create a new record and fill in the appropriate fields.
To see the total on hand for a given item, perform a find for that item so that only those records are in your found set.
Too see the total on hand for all items, create a summary report and use sorting to group all your records by Material ID.
Ahh I see that could be a helpful thing. Thank you Phil.