Home » Developer & Programmer » Reports & Discoverer » how to make sum on multiple feilds of multi queries (dev 6i)
how to make sum on multiple feilds of multi queries Wed, 23 January 2008 01:04
 annu-agi Messages: 218Registered: July 2005 Location: Karachi Senior Member
hi experts

i have develop one report which has multiple indipendent queries and has no relation between each others .. now i have to calculate some formula on there feilds .. when i tried to make formula column it shows rep-1517 that is obviously becasue there is no parent child relation b/w query blocks.

by the way lets suppose code is as simple like
```function CF_1Formula return Number is
v_oper_prof number(14,2);

begin
v_oper_prof:=:amt410_end+:amt520_end;
return v_oper_prof;
end;
```

there is no compilation error .. but it shows error when it runs ..

any idea .. any solution ..
how do i calculate feilds from diffirent query blocks.
*** for your ease .. i m attaching one pic file which shows you the data model to help you to give a better solution

regards

anwer
Re: how to make sum on multiple feilds of multi queries [message #295714 is a reply to message #295667] Wed, 23 January 2008 03:00
 Littlefoot Messages: 21128Registered: June 2005 Location: Croatia, Europe Senior MemberAccount Moderator
Here's an example: I've created two non-related queries:
```REM Q1
select deptno, sum(sal) sal
from emp
where deptno = 10```
```REM Q2
select deptno, sum(sal) sal
from emp
where deptno = 20```

Create summary columns (CS_1 and CS_2) whose sources are 'sal' and 'sal_2' respectively (both of them reset at 'report'). Finally, create a formula column (CF_1) which returns sum of summary columns:
`return (:cs_1 + :cs_2);`

This is a data model:

This is the result:

 Previous Topic: matrix report label problem Next Topic: How to do this in crystal report
Goto Forum:

Current Time: Mon Jul 24 05:46:11 CDT 2017

Total time taken to generate the page: 0.16777 seconds