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

Crystal Reports 2008, Oracle 11G Notes field, capture pattern begins with through to next space

Status
Not open for further replies.

hmax

Programmer
Jan 22, 2012
60
US
Crystal Reports 2008
Oracle 11g

Notes field contains pattern like "*AB*" followed by a series of numbers and/or letters, maybe or maybe not a "/", a "-", and/or text, inconsistent length.

For example:

Item, Company AB9000 IDU 1W
Item Type, AB9200
Item, Company AB7000S IST w/123H ABC w/o DVD
Item- Company AB7700S/AB7700S - P 2ND

I need to capture all instances where "*AB*" exists plus the pattern that immediately follows AB, and I believe that as long as I capture this result through to the next space, I will then be able to define it as a Yes result.

How will I consistently capture these results, please?

Thank you,

hmax
 
Hi hmax

The following will give you all charaters after the 1st occurence of 'AB':

Code:
If  	Instr({Table.Field}, 'AB') > 0
Then    Mid({Table.Field}, Instr({Table.Field}, 'AB') + 2)

Is that what you are after?

Cheers
Pete.
 
Just realised you only wanted the result only up to the first space after the 'AB', so try this:

Code:
WhilePrintingRecords;

Local StringVar x;
Local StringVar y;

If      Instr({Table.Field}, 'AB') > 0
Then    x := Mid({Table.Field}, Instr({Table.Field}, 'AB') + 2);

If      Instr(x, ' ') > 0
Then    y := Mid(x, 1, Instr(x, ' '))
Else    y := x;

y

There really isn't a need to use variables, but it makes it a whole lot simpler.

Hope it helps.

Pete
 
Testing this now, thanks, Pete!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top