Crystalkeen logo; we offer Crystal reports viewers and schedulers
 
Crystalkeen header image 3
Crystalkeen header image 5

Crystal Reports Tools: Improve Performance While Saving Time and Money

Crystal Reports: Split a String

See also: String variables longer than 254 characters.

This was an interesting question on Tek Tips (www.tek-tips.com) recently. The data in the field looked like…

Room No. from "4" to "6".

Room No. from "56" to "Store"

The request was to extract the values from between the quotes. After several approaches the simplest

solution was to use this formula to extract the first value.

split({@yourfield},'"')[2]

And the second value was extracted with

split({@yourfield},'"')[4]

The way this works is to split the field into a string array using the quote delimiter. Then the first member of the array is the value prior to the first quote, and can be ignored. The first formula then returns the second value in the array.

The third value in the array is the value between the two quoted values and the fourth value in the array is the second quoted value and is returned by the second formula.

Thanks CoSpringsGuy for an interesting solution to a complicated problem.

For an even better solution to the long string problem, see the notes on that subject here: String variables longer than 254 characters.

This video may also be helpful:

 

This article is copyrighted by Crystalkeen, Mindconnection, and Chelsea Technologies Ltd. It may be freely copied and distributed as long as the original copyright is displayed and no modifications are made to this material. Extracts are permitted. The names Crystal Reports and Seagate Info are trademarks owned by Business Objects.

Authorship

Except where an author's name is given at the start of the article, all of these articles were written by Mo Naughton or Bruce Ferguson and edited by Mark Lamendola. Mo is a Crystal Reports consultant, trainer, and developer for Chelsea Technologies, Inc. Bruce Ferguson is a Crystal Reports consultant, trainer, and developer for CrystalKiwi, Inc. Mark Lamendola is a writer and editor with over 15 years experience in professional and trade publications.

 

  • Questions? Please write to mark@crystalkeen.com. We do want your business.
  • Do you have your own tips for Crystal Reports administrators and designers? Write to mark@crystalkeen.com and we'll post your tips with a link to your Website (or with some other attribution if you choose).
  • Crystal Reports is a subsidiary of Business Objects, which is owned by SAP.