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: 238
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
/forum/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: 21813
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:

/forum/fa/3795/0/

This is the result:

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


Current Time: Thu Jul 04 12:04:58 CDT 2024