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!

Trim Formula

Status
Not open for further replies.

JMB7

MIS
May 19, 2004
26
US
Crystal 8.5

Hello all,
I have written a report where my end user now wants fields not to be combined. I now need to trim out these fields.
For example: physician name (pract_rpt_name) has last name, first name. I need to seperate these names.
Also need address (addr_line1) which contains street, city, state and zip. I also need to seperate these fields out.
Any help would be appreciated!
 
For the name field, use:

//{@lastname}:
split({table.fullname},", ")[1]

//{@firstname}:
split({table.fullname},", ")[2]

For the address field, you can use the same formula:

split({table.address1},", ")[1]//or [2] or [3]

If you want state and zip separate also, use:

split(split({table.address1},", ")[3]," ")[1]
//[1] for state and [2] for zip

-LB
 
It worked - thank you very much for your help. Would like to gain more knowledge on formula syntax, any suggestions on reference books or web sites I can refer too? Again thank you for your help.
 
The help files are very useful in learning about functions and formula syntax. You could also try Ken Hamady's site--look for his FAQ on common formulas in the FAQ tab. George Peck's books "Crystal Reports x.0: The Complete Reference" are good, too. The most useful learning tool might be just following posts in this forum.

-LB
 
George Peck put out another book about 1.5 years ago that was pretty good. I believe it had a formula reference in the back. The book is called "Crystal Reports: Professional Results"

~Brian
 
I now have another problem.
My formulas:
//{@firstname}
split({pract_mstr_orgz_v.pract_rpt_name},", ")[2]
//{@lastname}
split({pract_mstr_orgz_v.pract_rpt_name},", ")[1]
//{@combinename}
{@First Name}+' '+{@Last Name}
I successully 'seperated' the names, placed first name first and last name second but I am getting
John MD Smith
Richard MD Ahern
I realize now that I really did not need to seperate the names in the first place (just rearrange them) but now I need to remove MD from the name. Thank you for any suggestions.

 
It sounds like the "MD" follows the first name in your database, as in:

Smith, John MD

If so, then try:

//{@firstname}
left(split({pract_mstr_orgz_v.pract_rpt_name},", ")[2],instr(split({pract_mstr_orgz_v.pract_rpt_name},", ")[2]," ")-1)

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top