Home » Developer & Programmer » Reports & Discoverer » Using conditinal operator in Formula column (Report 6i)
Using conditinal operator in Formula column [message #381680] Mon, 19 January 2009 03:51 Go to next message
mahantesh
Messages: 28
Registered: March 2008
Location: Mumbai ,India
Junior Member
Hi,
I want ask that can we use conditional operator in the PL/SQL formula section of formula column, If not then how can we use conditional operators on formula column.

I want to compare whether :CP_rev is less than zero or not for this i had written PL/SQL code on formula column function as

function CF_GOPFormula return Number is
begin
IF :CP_REV <=0 THEN
srw.message(10,'Revenue is null');
srw.message(10,'Revenue is null');
return 0;
ELSE
return :CP_Rev-:CP_Cost;
END IF;
end;

but i am not getting required effect, can anybody give me hint

Re: Using conditinal operator in Formula column [message #381776 is a reply to message #381680] Mon, 19 January 2009 14:57 Go to previous message
Littlefoot
Messages: 20896
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I don't have Reports 6i, but such a code works perfectly OK on 10g. By the way, what does
Quote:
i am not getting required effect
exactly mean?

My sample query was simple:
select -10 cp_rev, 5 cp_cost
from dual

Formula column was taken from your example:
function CF_1Formula return Number is
begin
  if :cp_rev <= 0 then
     return 0;
  else
     return :cp_rev - :cp_cost;
  end if;
end;

I have modified the CP_REV value to a positive value, and formula column's value was displayed properly.
Previous Topic: How to register Discoverer report as a concurrent program in apps?
Next Topic: How to put department wise page break.
Goto Forum:
  


Current Time: Tue Dec 06 08:31:57 CST 2016

Total time taken to generate the page: 0.11257 seconds