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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using a formula in a if then else statement

Status
Not open for further replies.

gilsonr

Technical User
Mar 16, 2002
19
GB
I have created the folloing if then else statement in a formula field

if status = "86" then "Live" else
if status = "87" then "Live" else
if status = "88" then "Live" else
if status = "89" then "Live" else
if status = "90" then "Live" else
if status = "91" then "Archive" else
if status = "97" then "Archive" else
if status = "98" then "Archive" else
if status = "85" then "Archive" else
"Unknown"

The status variable is an existing formula, can I do this in Crystal.
 
yes you can except that you need to use the backets

if {status} = "86" then "Live" else

and make sure that the (Status) formula is string and not numeric, if is numeric siply remove the ""

if {status} = 86 then "Live" else

one more thing, ensure that {Status} always return some value even if that is a zero, null value will make the formula fail


-Mo
 
Thanks for the response, amended the code as follows
if {status} = 86 then "Live" else
if {status} = 87 then "Live" else
if {status} = 88 then "Live" else
if {status} = 89 then "Live" else
if {status} = 90 then "Live" else
if {status} = 91 then "Archive" else
if {status} = 97 then "Archive" else
if {status} = 98 then "Archive" else
if {status} = 85 then "Archive" else
"Unknown"

But I keeo geeting an error meaasge stating that field name is not know, when I Check the code.

Also how do I return some value of zero.
 
if the field name is not known than it means that you are not using the right field,

whithin the formula creation panel you have the option to drag the field you want in your formula, just search from the list of available fields

you'll find that the name is something like

{@Status}


-Mo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top