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!

Crystal Reports XI - formula syntax

Status
Not open for further replies.

sbreeden

Technical User
Mar 11, 2009
1
US
In Crystal XI, how do I pull a string from the first part of a field stopping at at the ";" contained in the field?

For example if the field = "7689; 8dfy8e"
I would want the output to be "7689
 
You would need to use 2 formulas. One to find the ";" and the other to then pull out te characters you need.

The first forumlua would use the Instr function to find the ";". You can see how to format it in the Crystal Reports Help File. This will return a number.

Th second formula would use the Left function to start from the beginning and stop by what ever value the Instr returns.
 
You could do this in one formula:

stringvar x := {table.string};
if instr(x,";") > 0 then
left(x,instr(x,";")-1) else
x

Or you could use:

extractstring({table.string},"",";")

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top