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

take extract from a string

Status
Not open for further replies.

grom71

IS-IT--Management
Oct 23, 2003
56
GB
Hi all,
I have a database field which I want to extract some text from.
Below is the string which appears evertime in the database in the same structure.
RTS{KINGS MILL HOSPITAL{RTS0603398{ONLY RECEIVED 30 PACKS{

For every record I want to extract the following text "{ONLY RECEIVED 30 PACKS{" bit which obviously will be different for every record.

Does anyone know how to do this ?
I would greatly appreciate any help.....:)
Kind Regards
Steve
 
The following will extract everything after RTS{KINGS MILL HOSPITAL{RTS0603398{ and before the next "{".

The above string would result in "ONLY RECEIVED 30 PACKS"

I did it this way in case there was anything after the "30 packs" section (in bold below)

stringvar extract:= "RTS{KINGS MILL HOSPITAL{RTS0603398{ONLY RECEIVED 30 PACKS{some other stuff maybe???" //replace this with your field ;
mid(extract,36,instr(36,extract,"{")-36)



Mike
 
Hi Mike,
Thanks for your response...
I think your suggestion will work but I havent tried it as looking at it its counting the characters which I think is 36.
The problem is that the KINGS MILL HOSPITAL bit can also be different.
heres a couple more examples:
RTS{AAH PHARMACEUTICALS LTD{RTS0603401{2 * 100 ORDERED BUT 2 * 28 DELIVERED.{

RTS{AAH PHARMACEUTICALS LTD{RTS0602397{DAMAGED{

Would this formula still work considering this ?
Steve
 
Try using The following Formula

//@StringExtract
Whileprintingrecords;

stringVar Array strText := Split ({Table.Field},'{');
strText[4]

Thisj should do the trick

Gary Parker
MIS Data Analyst
Manchester, England
 
Use Gary's method, it should do the trick for you.

For future posts, your initial post should be more like your second post in this thread. The more examples you can supply, the better the responses you'll receive. It helps to reduce the "guess factor"

Mike
 
Gary,
Thanks for your help, I really appreciate it.
Mike,
Thanks for your help also, I'm sorry I didnt feed you enough info, your right I need to give more info next time
Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top