Page 1 of 1

Data extract from source

Posted: Wed Feb 06, 2008 11:04 am
by Tlam
Hi,

I need some advice on following data extract.

In the source there is a field with following data format

A12-ABCDEFG123456 ^ 12345678

Now I want only the part ABCDEFG123456

I have tried Field(Mystring, "-", 1) which will give me result = A12 if I use Field(Mystring, "-", 2) it will give me result = ABCDEFG123456 ^ 12345678

Please advice me how to get only ABCDEFG123456

Thanks.

Tlam

Posted: Wed Feb 06, 2008 11:10 am
by paddu
how about

Step 1
A1= Field(Mystring,'^',1) which gives result=A12-ABCDEFG123456
then
A2=Field(A1,'-',2) which gives result=ABCDEFG123456

use stage variables to achieve this

Thanks
Paddu

Posted: Wed Feb 06, 2008 3:04 pm
by ray.wurlod
For something that simple, you could nest the Field functions.

Code: Select all

Field(Field(InLink.MyString, "-", 2, 1), "^", 1, 1)
The MatchField() function can also be used here.

Code: Select all

MatchField(InLink.MyString, "0X'^'0X'-',0X",3)

Posted: Wed Feb 06, 2008 4:12 pm
by paddu
[quote="ray.wurlod"]For something that simple, you could nest the Field functions.

Code: Select all

Field(Field(InLink.MyString, "^", 2, 1), "-", 1, 1)
As Ray suggested nested field functions is good .

Ray's function is resulting 12345678

Probably below is the one you are looking ,which results ABCDEFG123456

Field(Field(InLink.MyString, "^", 1, 1), "-", 2, 1)

Posted: Wed Feb 06, 2008 7:48 pm
by ray.wurlod
Edited my previous post to correct typo.
:oops:

Posted: Thu Feb 07, 2008 2:34 am
by Tlam
Thanks guys for the advice :D