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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parsing out a string 1

Status
Not open for further replies.

McFly77

IS-IT--Management
Jun 20, 2012
8
US
Hi all,

I'm a complete newbie in the Crystal and wondering if someone could help me. I have a field that i need to parse out, unfortunately it is of variable length and content, but the format is the same.

example:

Product(s) : (07 Puzzlemania Activity Bulk 687,950) ;3rd Party Ship/Focus Logistics

Desired Result:

07 Puzzlemania Activity

The field will always start with

Product(s) : (

then list what i'm looking for, and end with either "Bulk" or "Samples"

there may or may not be info in the "3rd Party Ship" area
 
Hi McFly77

Assuming uou want everything after the second '(' and finishing before the word 'Bulk' or 'Samples', create this formula:

// Parse Formula
If Instr({table.field}, 'Samples') <> 0
Then Mid({table.field}, 15, (Instr({@table.field}, 'Samples')-15))
Else
If Instr({table.field}, 'Bulk') <> 0
Then Mid({table.field}, 15, (Instr({table.field}, 'Bulk')-15))



Cheers
Pete
 
Thank You Pete! Works perfect!

Marty
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top