Page 1 of 1

SWITCH and CASE

Posted: 09 Jan 2014, 13:08
by wadesnj
Is there anyway to use the SWITCH statement in the expression editor?
I can do this:

PURCHASE_ORDER.TAKEN_BY = "seanm" ? "Sean Maxfield" :
PURCHASE_ORDER.TAKEN_BY = "MANAGER" ? "Manager" :
PURCHASE_ORDER.TAKEN_BY = "bobh" ? "Bob Huxtable" :""

But what I want to do is this:

Switch PURCHASE_ORDER.TAKEN_BY
Case "Seanm"
? "Sean Maxfield"
Case "MANAGER"
? "Manager"
etc.
End

But this does not work, the systax is incorrect, although there is an example of this in the report designer online help!!

Re: SWITCH and CASE

Posted: 09 Jan 2014, 13:29
by brucedenney
I think in a Switch you would be using : not ?

Not sure what/how you set the values, these are normally used for formatting styles rather than setting values in conditional formatting expressions.

I might take a look later.

Re: SWITCH and CASE

Posted: 09 Jan 2014, 14:28
by wadesnj
Thanks Bruce, much appreciated if you get time to take a look at it, would be very useful where there are a lot of users, I have 12 in the expression above!

Re: SWITCH and CASE

Posted: 14 Jan 2014, 11:02
by brucedenney
Checked it out and I can not use them the way you are trying.