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!

convert text of parameter to appear on report

Status
Not open for further replies.

kamv

MIS
Jun 14, 2002
22
US
Hi,
I am writing a report using Crystal Reports version 8.5. I have created a parameter called {?Location}which will prompt a user to select a location from a drop down list. I want the parameter to appear on the page header but not as what the user selected but rather to what I define. For example they pick "USA" for the list I want it to appear as "United States of America" on the report.I know how to put the parameter on the report I just don't know how to convert it (formula?).
I appreciate any suggestions.
Thanks

Kamv
 
Kamv,

The only way I know to solve your problem would be to create a formula field using "if/then" or "case" logic.
 
you need a "Case Select" look-up table

for example:

******************************************
@DisplayParm_Location

WhilePrintingRecords;
stringVar result := "Location: "

Select uppercase({?Location})

Case "USA":
result := result + "United States of America"
Case "CDN":
result := result + "Canada"
Case "UK":
result := result + "England"

... add as mant cases as you like ...

Default:
//this default catches values that require maintenance
result := result + {?Location};

result;

******************************************

That should do it...this is easy to maintain...you can get fancy and change the background color to alert the user that new case selections are required if you like
Jim Broadbent
 
Thanks for the suggestions.

I think I realized my problem: I was taking the actual parameter and putting it in the page header and then trying to format it with a formula (in paragraph formating - text interpertation - I am not sure why I tried it there).
I removed the parameter from the field and instead created a formula with a if else control structure like you suggested.
if {?Location} = "USA"
then "United States of America"
else ...etc.
I then inserted it into the page header and it worked!
Thanks again for your help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top