Home » Developer & Programmer » Reports & Discoverer » Placeholders and Summing Data
Placeholders and Summing Data [message #167629] Fri, 14 April 2006 14:54 Go to next message
Steve Corey
Messages: 336
Registered: February 2005
Location: RI
Senior Member
Hello all!

I have a question regarding placeholder columns in Reports 6i. I inherited a report from a colleague who LOVED the functionality of placeholders and judging by the way the report runs, it seems justified. However, I had to make some adjustments to this report, mainly summing two of these placeholders together and deleting one of the columns. The code being used to populate the placeholders seems to work fine, however when I want a total for the row using the two different placeholders, I always get NULL. Here is the assignment code:

function CF_TOTALHOURS_ASSIGNMENTFormul return Number is
begin
	IF :SATDTTIME2 <> :CP_CHKTOTRESET THEN
		:CP_STRTIME_HOURS := NULL;
		:CP_CALLINOT_HOURS := NULL;
		:CP_EOHRS := NULL;
		:CP_1HALFOT_HOURS := NULL;
		:CP_SCHHOLWK_HOURS := NULL;
		:CP_HOLST := NULL;
		:CP_VACATION := NULL;
		:CP_SICK := NULL;
		:CP_PER := NULL;
		:CP_DEFVAC := NULL;
		:CP_LWOP := NULL;
		:CP_OTHERHRS := NULL;
		:CP_OTHERHRS2 := NULL;
	END IF;
	
	
	IF :TOTALOTH_HOURS > 0 THEN
     	IF :EXPTYPE = 'SO' THEN
     	:CP_STRTIME_HOURS := :TOTALOTH_HOURS;
   	END IF;
[B]     	IF :EXPTYPE IN ('C') THEN
  		 :CP_CALLINOT_HOURS := LTRIM(:CP_CALLINOT_HOURS||'/'||TO_CHAR(:TOTALOTH_HOURS),'/');
  		-- :CP_EOHRS := LTRIM(:CP_EOHRS||'/'||TO_CHAR(:TOTALOTH_HOURS),'/');
  		 --:CP_CALLINOT_HOURS := :TOTALOTH_HOURS;
     	END IF;	
     		IF :EXPTYPE IN ('EO') THEN
  		 :CP_EOHRS := LTRIM(:CP_EOHRS||'/'||TO_CHAR(:TOTALOTH_HOURS),'/');
  		 --  		 :CP_EOHRS := :TOTALOTH_HOURS;
  		 :CP_CALLINANDEOHRS := (:CP_EOHRS + :CP_CALLINOT_HOURS);
     		END IF;[/B]	


The bolded part is giving me a problem. Is it the way the IF statements are structured? Or am I completely off with what I am trying to accomplish?

What I want to do is sum together the placeholder value in :CP_EOHRS and :CP_CALLINOT_HOURS.

Any help is greatly appreciated! Thank you!

Regards,
Steve
Re: Placeholders and Summing Data [message #167843 is a reply to message #167629] Mon, 17 April 2006 08:07 Go to previous message
Steve Corey
Messages: 336
Registered: February 2005
Location: RI
Senior Member
OK I got it.

What I did was keep the original assignment to the placeholder columns. Then I created two summary columns for the columns I wanted to sum at the group above the assignment. I had to make sure that I specified a NVL value of 0 if the column was null (otherwise placeholders pass the NULL value for the whole row). I then created a formula column in the same group as the summary columns summing the two together. I then used a format trigger to hide the field in the layout if the summed value was 0 (a report requirement I left out of my original post).

I hope this helps somebody down the road!

Cheers! Cool
Previous Topic: Run report from batch file
Next Topic: Oracle reports and SQL SERVER 2000
Goto Forum:
  


Current Time: Sun Jun 30 15:08:27 CDT 2024