AnsweredAssumed Answered

Param in a Case Statement

Question asked by bfarquhar on May 27, 2011
Latest reply on Jun 1, 2011 by mansriva
Is it possible to use a Param in a case statement ? I'm trying to figure out the NSQL syntax to do something like this.....

SELECT
CASE WHEN PARAM = 1 THEN (Complex Calc) ELSE (some field)
FROM table

the value for the PARAM would come from a filter in my portlet.

Ultimately what I'm trying to do is give the user the option to display effort based fields in "housr" or "FTE". What I was thinking of doing is giving them a filter that has the options of FTE (Code = 1) or Hours (code =2). Then in my query use the above case logic to display the value in either Hours or FTE.

If the case logic is not posible is there something else I could try ? Has anyone done this type of thing before and could share the code ?

Thanks,
Ben

Outcomes