Home » Developer & Programmer » Forms » Saving a calculated field (form developer 6i second release)
Saving a calculated field [message #294876] Sun, 20 January 2008 06:37 Go to next message
ashraf_al_ani
Messages: 92
Registered: October 2007
Location: Iraq
Member
Dear all

I have a calculated field as
:quantity*:unit_price and the result goes to a field :total
all quantity and unit_price and total are fields in the database
but when i open my table the data in field "total" is empty
so how can I save the result in a form to my database for the total field

best regards
Re: Saving a calculated field [message #294886 is a reply to message #294876] Sun, 20 January 2008 07:55 Go to previous messageGo to next message
vamsi kasina
Messages: 2107
Registered: October 2003
Location: Riyadh, Saudi Arabia
Senior Member
When are you populating the field total (in which trigger)?

By
Vamsi
Re: Saving a calculated field [message #294961 is a reply to message #294876] Mon, 21 January 2008 00:50 Go to previous messageGo to next message
sasipalarivattom
Messages: 118
Registered: June 2007
Location: Cochin ( INDIA )
Senior Member

Hi Ani,
I think you give the calculation in formula property of field total.
One important note on calculated field is that they will not be saved even if it is a database item.
you need to use any other method..

Regards
Sasi...
Re: Saving a calculated field [message #294983 is a reply to message #294876] Mon, 21 January 2008 01:35 Go to previous messageGo to next message
ashraf_al_ani
Messages: 92
Registered: October 2007
Location: Iraq
Member
thanks for answering me
any idea???
Re: Saving a calculated field [message #294986 is a reply to message #294983] Mon, 21 January 2008 01:44 Go to previous messageGo to next message
sasipalarivattom
Messages: 118
Registered: June 2007
Location: Cochin ( INDIA )
Senior Member

Hi ani,

There are 2 methods that i use.

1. Create a non database item for calculation and show it in the
form.No need to show the database item.

Then before saving, assign this calculated value to your
database field. Beware of update also. Means if you assign value
in preinsert only, total will not be updated when you update
quantity or Price.

2. Remove the calculation from the total field, then calculate the
total and assign it from the WHEN-VALIDATE Trigger of quantity
and price.

There may be some other simple methods.. Am looking for it.
If you get something, Please share it.

Regards
Sasi..
Re: Saving a calculated field [message #295076 is a reply to message #294876] Mon, 21 January 2008 04:50 Go to previous message
Littlefoot
Messages: 20891
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
ashraf_al_ani
so how can I save the result in a form to my database for the total field

Why would you do that? 'Total' value is redundant as it can always be calculated by multiplying 'quantity' and 'price'.
Previous Topic: how to open the windows open file dialog box from forms9i
Next Topic: message from backend to front end
Goto Forum:
  


Current Time: Sun Dec 04 00:50:26 CST 2016

Total time taken to generate the page: 0.11288 seconds