Home » Developer & Programmer » Forms » Running Sum in Form
Running Sum in Form [message #170952] Sat, 06 May 2006 10:56 Go to next message
Rehan Mirza
Messages: 67
Registered: July 2004
Location: Pakistan
Member

I need running sum dept wise in form.......

ENAME DEPT SAL RUNSUM
--------------------------
TEST1 10 100 100
TEST2 10 300 400
TEST3 10 800 1200
TEST4 20 500 500
TEST5 20 300 800
TEST6 30 900 900


i do all DML in form i works on runtime


thanks & regards
R E H A N M I R Z A
Re: Running Sum in Form [message #171042 is a reply to message #170952] Mon, 08 May 2006 01:42 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Search this forum for 'calculation mode'. You could also search for it in the reference manual.

David
Re: Running Sum in Form [message #171048 is a reply to message #171042] Mon, 08 May 2006 02:02 Go to previous messageGo to next message
orausern
Messages: 826
Registered: December 2005
Senior Member
Use analytical functions:


SQL>  select ename,deptno,sal, sum(sal) over(partition by deptno order by ename) from emp;

ENAME          DEPTNO        SAL SUM(SAL)OVER(PARTITIONBYDEPTNOORDERBYENAME)
---------- ---------- ---------- -------------------------------------------
CLARK              10       2450                                        2450
KING               10       5000                                        7450
MILLER             10       1300                                        8750
ADAMS              20       1100                                        1100
FORD               20       3000                                        4100
JONES              20       2975                                        7075
SCOTT              20       3000                                       10075
SMITH              20        800                                       10875
ALLEN              30       1600                                        1600
BLAKE              30       2850                                        4450
JAMES              30        950                                        5400

ENAME          DEPTNO        SAL SUM(SAL)OVER(PARTITIONBYDEPTNOORDERBYENAME)
---------- ---------- ---------- -------------------------------------------
MARTIN             30       1250                                        6650
TURNER             30       1500                                        8150
WARD               30       1250                                        9400

14 rows selected.
icon3.gif  Re: Running Sum in Form [message #171066 is a reply to message #170952] Mon, 08 May 2006 03:55 Go to previous messageGo to next message
Rehan Mirza
Messages: 67
Registered: July 2004
Location: Pakistan
Member

I need to done it on form not on report or SQL

Best regards,
R E H A N M I R Z A
Re: Running Sum in Form [message #171067 is a reply to message #171066] Mon, 08 May 2006 04:07 Go to previous messageGo to next message
orausern
Messages: 826
Registered: December 2005
Senior Member
Well, can you not make use of the sql query in the form?
Re: Running Sum in Form [message #171078 is a reply to message #170952] Mon, 08 May 2006 05:00 Go to previous messageGo to next message
Rehan Mirza
Messages: 67
Registered: July 2004
Location: Pakistan
Member

What can i do when i insert, update or delete???? and also there is performace issue if i use query ...

Best regards
R E H A N M I R Z A
Re: Running Sum in Form [message #171079 is a reply to message #171078] Mon, 08 May 2006 05:03 Go to previous messageGo to next message
orausern
Messages: 826
Registered: December 2005
Senior Member
I did not get your first question..can you please explain in more detail? regarding performance, use of analytical function is generally allways helping in getting better performance.

also here the requirement was to get to the running total..here the quetion of update does not arise..it is a query to the database.
Re: Running Sum in Form [message #171171 is a reply to message #171079] Mon, 08 May 2006 18:28 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Heloo, hello?? Anyone there?? Use the 'calculation' properties for the item that you wish to sum.

David
Previous Topic: Updating value
Next Topic: Counting the number of rows in a group
Goto Forum:
  


Current Time: Fri Sep 20 07:33:03 CDT 2024