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 [message #295667] Wed, 23 January 2008 01:04 Go to next message
annu-agi
Messages: 199
Registered: 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
./fa/3794/0/
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 Go to previous message
Littlefoot
Messages: 20888
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account 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:

./fa/3795/0/

This is the result:

./fa/3796/0/
Previous Topic: matrix report label problem
Next Topic: How to do this in crystal report
Goto Forum:
  


Current Time: Fri Dec 02 20:27:27 CST 2016

Total time taken to generate the page: 0.05292 seconds