Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with a CASE statement 2

Status
Not open for further replies.

choochoowinn2009

Technical User
Feb 24, 2010
34
US
I'm trying to write a CASE statement, but it's coming out with this error message. "The selection formula must be a boolean". My ID field is a string. Can anyone help?

Select ToNumber ({NoName.GUARD_ID})
Case 15, 16, 17, 18 :
"Medium"
Case 19 :
"Good"
Case 21 :
"Bad"
Default :
"None"


 
I tried your formula with values from my database for Age (string,3) and did not get any errors.
Might you have values in the database that are not numeric?

you could add a numeric check into your current formula:

If isnumeric({NoName.GUARD_ID}) then
(
Select ToNumber ({NoName.GUARD_ID})
Case 15, 16, 17, 18 :
"Medium"
Case 19 :
"Good"
Case 21 :
"Bad"
Default :
"None"
)
 
The message you got indicates you are trying to use this in your selection formula. Instead you should be creating this in field explorer->formula->new. You would then use the formula instead of the original field in the body of your report. If you need to select certain ID numbers, use the original field, as in:

{NoName.GUARD_ID} in ["15" to "19","21"]

-LB
 
Fischeromacse -
I just tried your statement, and it still gives me the same error message. How else would I go about getting around the numeric data even though it is a string?

lbass - I tried it your way as in a formula field, and it works. That's very strange though. It should work in either selection formula and formula field.

Thank you!!!
 
My response was assuming that you needed the values displayed via formula.

I agree with lbass, you should be displaying this via formula, not via record selection.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top