views:

2430

answers:

1

I have a switch statement in a Crystal Report that looks like this:

stringvar tag := {table1.field1};  //contains a string value

select tag case
  'First Value': {table1.field3}
  'Second Value': {table4.field9}
  default: 'Unknown';

But when I try to save the formula, I get this error:

---------------------------
Crystal Reports
---------------------------
The remaining text does not appear to be part of the formula.
---------------------------
OK   
---------------------------

And it highlights the formula beginning with the single quote before the word "Second" in my example.

What stupid syntax error am I making?

+3  A: 

Shouldn't this be written as...

select (tag )
  case 'First Value': {table1.field3}
  case 'Second Value': {table4.field9}
  default: 'Unknown';

?
Note, I just looked the syntax online; I'm not a Crystal Reports specialist...

mjv
You got it - I was just being obtuse today I guess
JosephStyons
@Joseph I relate to that, I got them days too :-) That's where SO is a fine place: we find an audience for discussing both complicated matter or basic-typos-type-of-bugs on these "foggy days".
mjv