Hi,
if often have two columns in a listview which depend on each other.
For instance discount = ((gross_price - net_price)/gross_price)*100.0
and net_price = ((100.0-discount)/100.0) * gross_price
I want the user to be able to type a discount, but also to type a net_price and in both cases the other value must be calculated.
And i do not want to store both values in the database.
What i tested now is :
-
create database fields net_price and gross_price
-
create an unstored calculation discount with the formula :
return ((gross_price - net_price)/gross_price)*100.0;
- set the unstored calculation editable
- create an onDataChange method on the unstored calculation field :
var _discount = arguments[1]
net_price= ((100 - _discount) / 100) * gross_price
Works excellent !!!
Regards,
Hans
In the previous 4Gl I used