Search code examples
cognoscognos-11

I am having IF THEN ELSE error using Parameters


I have an expression that says:

IF (?Quarter Selection? = 'PY 2017 Q3' 
    AND ?Type of Report? = 'Exiter Report') 
THEN ([Seeker Status Date] BETWEEN TO_DATE('10/01/2017', 'MM/DD/YYYY') 
    AND TO_DATE('12/31/2017', 'MM/DD/YYYY')) 
ELSE (1=1)

I get a host of errors when I validate it. If I take out one of the parameters in the IF section, it works fine. Example:

IF (?Quarter Selection? = 'PY 2017 Q3') 
THEN ([Seeker Status Date] BETWEEN TO_DATE('10/01/2017', 'MM/DD/YYYY') 
    AND TO_DATE('12/31/2017', 'MM/DD/YYYY')) 
ELSE (1=1)

Can you not have more than one parameter in the statement?


Solution

  • You are trying to return conditional expressions.

    [Seeker Status Date] BETWEEN TO_DATE('10/01/2017', 'MM/DD/YYYY') 
        AND TO_DATE('12/31/2017', 'MM/DD/YYYY')
    

    and

    1=1
    

    are not values.

    Try returning values in the THEN and ELSE parts of the statement.