Home » Developer & Programmer » Forms » Formula column value not updating in table? (Oracle 10g, forms 10g)
Formula column value not updating in table? [message #521958] Mon, 05 September 2011 04:20 Go to next message
mm_kanish05
Messages: 493
Registered: January 2007
Location: Chennai
Senior Member

Hi all,

I create the sample for master/detail form. In detail for prdcode,rate,qty,amount is there. When select prdcode it fetching prdcode,rate in a record and if you type the qty the amout will come based on formula(property) :qty*:rate.

It is available on screen. But when i store the data, in backend table the amount is be a null.

What is the problem.

Help me in this regards,

kanish
Re: Formula column value not updating in table? [message #521960 is a reply to message #521958] Mon, 05 September 2011 04:24 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
It seems that AMOUNT is not a database item. Check its properties.
Re: Formula column value not updating in table? [message #521961 is a reply to message #521960] Mon, 05 September 2011 04:30 Go to previous messageGo to next message
mm_kanish05
Messages: 493
Registered: January 2007
Location: Chennai
Senior Member

The below one is the property setting value of Amount.

Database <section>

Database item : Yes
Column Name : Amount
Primary Key : NO etc.....

Kanish
Re: Formula column value not updating in table? [message #521972 is a reply to message #521961] Mon, 05 September 2011 05:10 Go to previous messageGo to next message
itech
Messages: 173
Registered: May 2008
Location: Fsd, Pakistan
Senior Member

as i experienced database item can't work as formula item,
u can deal it by having a control item as a formula item like (amount_) and on when_validate_recode trigger u can assign the value of (amount_) to amount(database item) column in detail block,
in master block u can do the same on pre_commit trigger
Re: Formula column value not updating in table? [message #521978 is a reply to message #521972] Mon, 05 September 2011 05:16 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Actually, what you (mm_kanish05) are doing is wrong. Data model violates normalization principles. In other words: it is OK to store quantity and rate values, but it is wrong to store "quantity * rate". It can always be presented in any reporting tool you use, in a very simple manner.

However, if you decide to store all three values, you have to make sure that every time someone updates quantity or rate, you have to update amount as well. Or: what will you do if someone updates the AMOUNT column's value? How will you recalculate quantity and/or rate?

So: drop that column and live without it.
Re: Formula column value not updating in table? [message #521981 is a reply to message #521978] Mon, 05 September 2011 05:25 Go to previous messageGo to next message
itech
Messages: 173
Registered: May 2008
Location: Fsd, Pakistan
Senior Member

Littlefoot wrote on Mon, 05 September 2011 15:16
Actually, what you (mm_kanish05) are doing is wrong. Data model violates normalization principles. In other words: it is OK to store quantity and rate values, but it is wrong to store "quantity * rate". It can always be presented in any reporting tool you use, in a very simple manner.

However, if you decide to store all three values, you have to make sure that every time someone updates quantity or rate, you have to update amount as well. Or: what will you do if someone updates the AMOUNT column's value? How will you recalculate quantity and/or rate?

So: drop that column and live without it.




please also guide if we need the sum of amount(detail block) to be saved in master block item(column) then ? the case is same ? now what to do ?
Re: Formula column value not updating in table? [message #521982 is a reply to message #521981] Mon, 05 September 2011 05:27 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Don't SAVE it in a table - if you wish, DISPLAY it (no problem about that).
Re: Formula column value not updating in table? [message #521983 is a reply to message #521981] Mon, 05 September 2011 05:28 Go to previous messageGo to next message
cookiemonster
Messages: 13937
Registered: September 2008
Location: Rainy Manchester
Senior Member
Again - don't store it. You can calculate it whenever you need it
Re: Formula column value not updating in table? [message #522033 is a reply to message #521983] Tue, 06 September 2011 00:18 Go to previous messageGo to next message
itech
Messages: 173
Registered: May 2008
Location: Fsd, Pakistan
Senior Member

i need to post sum(amount) in other table like (accounts) on insert / update of master so i need sum(amount) be saved in master ??
Re: Formula column value not updating in table? [message #522038 is a reply to message #522033] Tue, 06 September 2011 01:08 Go to previous message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
If you need it, then store it. Don't forget to update it when values (that were used to calculate it) change.
Previous Topic: How to clear line records when F11 is pressed in header block
Next Topic: Entering Mathematical Equations / Symbols
Goto Forum:
  


Current Time: Sat Sep 07 12:56:11 CDT 2024