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!

Trimming a string variable in Crystal 8.5 1

Status
Not open for further replies.

ba4crm

Technical User
Dec 19, 2003
92
US
Hi,
I am trying to add an address field in a report. The database has the address in City, State, Zip format. I only need to display the city in the report. How can I trim off the state and zip? I tried the Left(), but this will help only if I know the exact length of the city name (it is for different city names in the state).
 
Try this:
Code:
Left({table.address}, Instr(x,",")-1);

~Brian
 
Thanks Brian.
When I try to save the formula, I get the error message that a ")" is missing from infront of the x.
As far as I can tell there shouldn't be a close bracket their since it is not the end of the argument.
Any suggestions?
 
I am sorry. I used a variable to tes it and didn't remove the reference.
It should be this:
Code:
Left({table.address}, Instr({table.address},",")-1);


~Brian
 
Thanks much Brian. It worked perfectly.

Appreciate your input.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top