Home » Developer & Programmer » Reports & Discoverer » problems with functions
problems with functions [message #89950] Tue, 14 September 2004 00:44
Ian Clarito
Messages: 1
Registered: September 2004
Junior Member
Hello!

I am working with numerous field/column groupings in one report
and wanted to use a function that checks for the status of specific fields.

--begin function
FUNCTION TOGGLE_ITEM (FIELD_NAME VARCHAR2, ITEM_TYPE VARCHAR2) RETURN BOOLEAN IS
BEGIN
  IF ITEM_TYPE = 'DEFAULT' THEN  -- toggle A
    IF :FISHES = 'N' THEN
       RETURN FALSE;
    ELSE
       RETURN TRUE;
    END IF;
  ELSIF ITEM_TYPE = 'NEW' THEN   -- toggle B
    IF :HORSES = 'N' THEN
       RETURN FALSE;
    ELSE
       RETURN TRUE;
    END IF;
  END IF;
END;
--end function

In my example, the respective fields/columns ('HORSES','FISHES') will be checked depending on the ITEM_TYPE passed.
My problem is that when I run this function,
an error will show that it "...references column 'xxx' at wrong frequency" ('xxx' being either 'HORSES' or 'FISHES').

I think the cause of the problem is that the 'FISHES' and the 'HORSES' columns are grouped differently, since they're coming from different tables and using different queries.
I have already tried separating the function into 2 separate ones (1 for HORSES, 1 for FISHES) and its working perfectly.
Is there anyway for me to use just one function?

Thanks!

-ian
Previous Topic: discoverer: view empty rows
Next Topic: Break Matrix report
Goto Forum:
  


Current Time: Mon May 13 15:11:36 CDT 2024