Try setting up number fields with auto-enter calculations. They should allow you to either enter a value or allow the DB to calculate a value.
Thanks for your reply. I did what you said but didn't work. I created three fields cost_price, sell_price and margin_percentage. cost_price field as number, selling_price field as number and auto calculation with formula sell_price = cost / ( 1 - margin percentage ) and margin percentage number field and auto enter calculation margin percentage = 1 - (cost_price / sell_price). I put cost_price = 100 and it showed 100 in the sell_price, so i change sell price to 160 to see if it compute margin but showed 0 in the margin field. so i unchecked option "Do not replace existing value of field if any" under calculation check box but it did not work.
I think that you meant that you set up these fields: (See change in red)
sell_price = cost_price / ( 1 - margin percentage )
margin percentage = 1 - (cost_price / sell_price)
What I would try is:
sell_price = If ( IsEmpty ( self ) ; cost_price / ( 1 - margin percentage ) ; self )
margin percentage = If ( IsEmpty ( self ) ; 1 - (cost_price / sell_price) ; self )
And I think that will require clearing the 'do not replace...' check box in order to correctly update.
i copy and paste your calculation and unchecked 'do not replace... but it did not work. do i have to replace "self" with the field name.
You will not need to replace "self". How does it "not work"?
Only copy the text to the right of the "=" sign when you copy and paste these expressions.