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

Help with simple formula

Status
Not open for further replies.

hnts

IS-IT--Management
Dec 9, 2003
65
US
I am writing a report from data that is stroed in number format abd I'd like to convert that information to a predefined description.

Ex.
1 = PO (By Mouth)
2 = IM (Intramuscular)
3 = IV (intravenously)
Etc ..

I highlighted the field (3652_A.RA_21) and clicked on Select Expert and Show Formula and the following appears ...

not ({CLIENTS.STATUS} in ["EXPIRED", "TERMINATED"])

Any suggestions would be helpful. I'm a beginner with these types of formulas in Crystal but it seems easy enough.

Thanks in advance.





 
Is the highlighted field the field you want to show the description of?

what you want to do has nothing to do with the select expert, by the way.

Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
 
If you have a code table that decodes the value, you would link your original table to the code table on the code fields, and then display the description field {code.description}.

Otherwise you could create a formula:

If {3652_A.RA_21} = 1 then "PO (By Mouth)" else
if {3652_A.RA_21} = 2 then "IM (Intramuscular)" else
if {3652_A.RA_21} = 3 then "IV (intravenously)" else "Other"

-LB
 
OK .. since I'm not familiar with creating the code table (although it's probably allot easier and cleaner) I did create the formula .. except I'm unsure how to finish it.

not ({CLIENTS.STATUS} in ["EXPIRED", "TERMINATED"]) and
If {3652_A.RA_21} = 1 then "PO (By Mouth)" else
if {3652_A.RA_21} = 2 then "IM (intramuscular)" else
if {3652_A.RA_21} = 3 then "IV (intravenously)" else
if {3652_A.RA_21} = 4 then "Subq. (subcutaneously)" else
if {3652_A.RA_21} = 5 then "R (Rectally)" else
if {3652_A.RA_21} = 6 then "Topical or transdermal )" else
if {3652_A.RA_21} = 7 then "Inhalation" else
if {3652_A.RA_21} = 8 then "Other (Such as, by external tube)" else
if {3652_A.RA_21} = 9 then "SI (Sublingual)" else "Other"

Can you tell me what "Other" should be or how to proceed from here. Thanks again for your input.
 
You should NOT be creating this formula in the select expert (it looks like you are since you have the record select statement in the beginning of your formula). You should be creating this in the formula editor. In CR 8.0 this is found in insert->formula field->field explorer->formula->new. Remove the first line that so that the formula reads:

If {3652_A.RA_21} = 1 then "PO (By Mouth)" else
if {3652_A.RA_21} = 2 then "IM (intramuscular)" else
if {3652_A.RA_21} = 3 then "IV (intravenously)" else
if {3652_A.RA_21} = 4 then "Subq. (subcutaneously)" else
if {3652_A.RA_21} = 5 then "R (Rectally)" else
if {3652_A.RA_21} = 6 then "Topical or transdermal )" else
if {3652_A.RA_21} = 7 then "Inhalation" else
if {3652_A.RA_21} = 8 then "Other (Such as, by external tube)" else
if {3652_A.RA_21} = 9 then "SI (Sublingual)" else "Other"

If numbers 1 to 9 include all options in your field, then the formula is fine as is. You can leave "Other" in case someday there is a 10 or 11--to remind you to update the formula.

Just place the formula on your report canvas to view the description.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top