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!

Need a formula to parse a string for a name and extract value

Status
Not open for further replies.

meryls

Technical User
Nov 20, 2003
62
US
Hi!
I will be getting a memo data field that is a list of name-value pairs in the following format:

Terms:True; PrintSite:False; ShowBalances:True; Selection:product=TAC,State=NJ

I need to use this information to control printing characteristics, e.g., To suppress or show printing of a section, or to display the contents of the value in a textbox.

In order to do this, I need to parse the string in the data field, and check for the presence of a name in a name-value pair, then if the name exisits, operate on the value.

I am not sure what the correct syntax is in Crystal.

Thanks for your help!!

Meryl


 
I'll assume that your example data was wrong, and that each of the values are seperated by a semi-colan, as opposed to the , you have for the last element.

In CR 9 or above, just use:

split({table.field},";")[1]

Where the [1] ndicates which of the elements that you want.

If you want the value for Terms (true) use:

split(split({table.field},";")[1],":")[2]

If you do have different delimiters with the string, then you might use the split function to break out what you can, and then use left and mid functions to extract elements within.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top