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

Displaying "name" instead of code that pulls from database

Status
Not open for further replies.

sharvey90

Technical User
Apr 20, 2004
18
US
Crystal 8.5
Goldmine database

I'm creating an activity report that lists the activities (pulling from CONTHIST.RECTYPE) in the Detail section. The problem is that GM doesn't present the activity name, but rather picks up a 1-2 character "code" for the activity instead.

GM Tech Support sent me the list of the various first 1-2 characters of the rectype and their associated activities. An example is as follows:
A Appointment
C Phone Call
CC Call Back
CI Incoming Call

In my report I want to display the actual name of the activity as opposed to the 1-2 letter character code. For example,
If Rectype="CI" display "Incoming Call"

Any idea on how to accomplish this?
 
If you know all the code types and their names you can create a formula like this:

if {CONTHIST.RECTYPE} = "CI"

then "Incoming Call"

else if

if {CONTHIST.RECTYPE} = "C"

then "Phone Call"//similarly add all your code types here

else ""

Hope this helps!



Kchaudhry
 
Dear Sharvey90,

Try using the Case statement ... it is a little easier to understand:
Code:
Select CONTHIST.RECTYPE
case "A"  :  "Appointment"
case "C"  :  "Phone Call"
case "CC" : "Call Back"
case "CI" : "Incoming Call"
Default   : "Undefined!"

//Default exists to perform a default value if all the
//other values were not mathced.  I use it for error 
//handling!

Hope that helps,

regards,

ro

Rosemary Lieberman
rosemary@microflo.com, Microflo provides expert consulting on MagicTSD and Crystal Reports.
 
In response to Kchaudhry:
Once I create the formula where do I put it on the report? Do I replace my current field object [rectype] with the formula I created?

In response to rosemaryl:
I'm very new to Crystal, how do I create a case statement and where would I (or do I) put this on the report?
 
Sharvery,

Yes, you replace this formula with your current object field.

Kchaudhry
 
Dear Sharvey90,

Click Insert/Field Object/Click Formula, Click New (Ctrl-N, or right click and select new or click the New Icon in the Field Explorer Toolbar).

Give the formula a name.

Copy this (make sure that your field name is correct, find it in the list of fields for your table and highlight your field name below and double-click in the list of fields while the field name is selected and it will insert the field for you).

Select {CONTHIST.RECTYPE}
case "A" : "Appointment"
case "C" : "Phone Call"
case "CC" : "Call Back"
case "CI" : "Incoming Call"
Default : "Undefined!"


Regards,

ro


Rosemary Lieberman
rosemary@microflo.com, Microflo provides expert consulting on MagicTSD and Crystal Reports.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top