Home » Developer & Programmer » Forms » calculate sum in a form
calculate sum in a form [message #282830] Fri, 23 November 2007 23:28 Go to next message
white_phoenix
Messages: 19
Registered: November 2007
Junior Member
hi, i am a newbie. how do w calculate sum in a form? for example in datablock sale, I have few rows of data,
i want to calculate the total of product purchased (column totitem) and , sum of the customer have to pay. (totalprice). And i was hoping to do the calculation in a program unit

hoping for immediate repiles. Razz

[Updated on: Fri, 23 November 2007 23:33]

Report message to a moderator

Re: calculate sum in a form [message #282843 is a reply to message #282830] Sat, 24 November 2007 02:02 Go to previous messageGo to next message
akramrabaya
Messages: 41
Registered: November 2007
Member
hi, i am a newbie. how do w calculate sum in a form? for example in datablock sale, I have few rows of data,
i want to calculate the total of product purchased (column totitem) and , sum of the customer have to pay. (totalprice). And i was hoping to do the calculation in a program unit

hoping for immediate repiles.
[Updated on: Fri, 23 November 2007 23:33]


--create a new disply items on the same block
---for example name it purchase_total
--go to teh properties of this item
--go to the calculation section nad put the following values
calculation mode >>>>>> summary
summary function >>>>>> sum
summarized block >>>>>> ( block name ) in your case as u
mentioned it is "sale"
summarized item >>>>>> ( col. name ) in your case as u
mentioned it is ( the col. which represent product
purchased


note : you have also to make sure that in ur block properties to make query all records property as "yes"


akram
Re: calculate sum in a form [message #282861 is a reply to message #282843] Sat, 24 November 2007 04:35 Go to previous messageGo to next message
dbhossain
Messages: 155
Registered: August 2007
Location: Dhaka
Senior Member

Dear Mr.akram ,

Dont forget to set the property of your summerized block

"Query all Records"=True

Thanka
dbhossain
Re: calculate sum in a form [message #282877 is a reply to message #282861] Sat, 24 November 2007 08:59 Go to previous messageGo to next message
Littlefoot
Messages: 19885
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
But, he DID say that in his last sentence. Didn't he?
Re: calculate sum in a form [message #282886 is a reply to message #282830] Sat, 24 November 2007 12:11 Go to previous messageGo to next message
white_phoenix
Messages: 19
Registered: November 2007
Junior Member
er, in case you guys didn't notice, I did mention I want to calculate it in a program unit.
Re: calculate sum in a form [message #282888 is a reply to message #282886] Sat, 24 November 2007 12:28 Go to previous messageGo to next message
Littlefoot
Messages: 19885
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
OK; what prevents you to do that? Do you know how to calculate a sum? I'd use something like
SELECT SUM(column) INTO :block.item FROM some_table;
or its derivation (a WHERE clause, for example).

If you don't like that approach, loop through all block records and sum column values until you reach the last record.

But, WHY not using built-in Forms functionality? Is it because you like to reinvent the wheel?
Re: calculate sum in a form [message #282889 is a reply to message #282888] Sat, 24 November 2007 12:39 Go to previous messageGo to next message
white_phoenix
Messages: 19
Registered: November 2007
Junior Member
because when i did it using built in function, the text item or text field i created will display 10 rows of text item or text field to be displayed. For the data block to be calculated I set the property to display 10rows. But for total I only want 1 row
Re: calculate sum in a form [message #282896 is a reply to message #282889] Sat, 24 November 2007 16:19 Go to previous messageGo to next message
Littlefoot
Messages: 19885
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
OK; what prevents you to do that? Open Property Palette for summary item, go to Records properties and set "Number of Items Displayed" to 1 (one).
Re: calculate sum in a form [message #282953 is a reply to message #282896] Sun, 25 November 2007 09:05 Go to previous messageGo to next message
white_phoenix
Messages: 19
Registered: November 2007
Junior Member
oh can't do that. Because I want to display the other details 10 rows. Only for the total I want to display just one.
Re: calculate sum in a form [message #282956 is a reply to message #282953] Sun, 25 November 2007 09:36 Go to previous messageGo to next message
Littlefoot
Messages: 19885
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I said "for summary item", not for the whole block. There's a difference between those two terms.

./fa/3443/0/


[EDIT: added a screenshot]

[Updated on: Sun, 25 November 2007 09:44]

Report message to a moderator

Re: calculate sum in a form [message #283096 is a reply to message #282830] Mon, 26 November 2007 01:51 Go to previous messageGo to next message
white_phoenix
Messages: 19
Registered: November 2007
Junior Member
ok, problem solved. lots of thanks Wink
Re: calculate sum in a form [message #334445 is a reply to message #282830] Wed, 16 July 2008 09:27 Go to previous messageGo to next message
alquarles
Messages: 2
Registered: May 2008
Location: New York
Junior Member
How would you calculate the sum of this if a user wants to see the information of person A or information of person B. For example, items belonging to only person A or items belonging to only person B?
Re: calculate sum in a form [message #334470 is a reply to message #334445] Wed, 16 July 2008 11:35 Go to previous messageGo to next message
Littlefoot
Messages: 19885
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Probably with some (PL/)SQL coding.
Re: calculate sum in a form [message #570065 is a reply to message #282843] Mon, 05 November 2012 05:53 Go to previous message
shareef.hiasat
Messages: 3
Registered: November 2012
Location: Jordan
Junior Member

note : you have also to make sure that in your block properties to make query all records property as "yes"

greate tip helped alot

Laughing
Previous Topic: Oracle spread table OCX
Next Topic: Absent Employee Report Query
Goto Forum:
  


Current Time: Thu Dec 18 17:55:04 CST 2014

Total time taken to generate the page: 0.11571 seconds