Hello All
I would like to suggest a different function to PC SOFT to be available in Version 14.
This function returns the difference between the current and the previous value of an expression.
The one's that I miss from my old 4GL function...
syntax:
Result = DifferentValue(expression)
Use:
the different function subtracts the old value from the new value and returns
the different
To illustrate:
this function operates differently depending on the operating mode:
Add mode
the old value of expression is always zero, so the result is the new value.
DifferentValue = new - 0
12 = 12 - 0
Modify mode
the old value is substracted from the new, this is where it is really usefull.
DifferentValue = new - old
2 = 12 - 10 or
-4 = 6 - 10
Delete mode
the new value of expression is always zero, the result is substracted from
zero, giving the negative of the old value.
DifferentValue = 0 - old
-10 = 0 - 10
In code...
// Add mode //
mst_stock.quantity_on_hand -= dtl_sales.quantity
hadd(dtl_sales)
or...
mst_stock.quantity_on_hand -= DifferentValue(dtl_sales.quantity)
hadd(dtl_sales)
// Modify mode //
mst_stock.quantity_on_hand -= DifferentValue(dtl_sales.quantity)
hmodify(dtl_sales)
// Delete mode //
mst_stock.quantity_on_hand -= DifferentValue(dtl_sales.quantity)
hdelete(dtl_sales)
This function is really usefull when files update operations on procedure/ trigger
Regards
Toddy
Edited 1 time(s). Last edit at 11/23/2008 10:05AM by Toddy Utomo.