Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
tab1:
id,
description
from test.qvd
The description field contain data like this:
aaaaa,
bbbbb,
test1| test 2| test3| Good
test1| test10| test 2| very good
test3| test 2| test3| good
test5| test 2| test3| Good
test16 test 2| test3| good
I want to extract the data starting after the first ' | ' could you please help?
I used this :
if(trim(subfield(SubField(description ,'|',-1),'(',1))='good','Good',description ) as [Sub Category],
But after this extraction I still have something like :
aaaaa,
bbbbb,
test1| test 2| test3| Good
test1| test10| test 2| very good
test3| test 2| test5| Good
test5| test 2| test3| Good
test16 test 2| test4| Good
I want to see this:
aaaaa,
bbbbb,
test 2| test3| Good
test10| test 2| very good
test 2| test5| Good
test 2| test3| Good
test 2| test4| Good
Hi Constantin,
maybe
LOAD id,If(Index(description,'|',1)>0,Mid(description,Index(description,'|',1)+1),description) as description
Inline [
id,description
1,aaaaa,
2,bbbbb,
3,test1| test 2| test3| Good
4,test1| test10| test 2| very good
5,test3| test 2| test3| good
6,test5| test 2| test3| Good
7,test16| test 2| test3| good
];
Regards,
Antonio
<<correction>>
load mid(f2,index(f2,'|',1)+1,len(f2)) as SubCategory Inline [
f2
aaaaa
bbbb
test1| test 2| test3| Good
test1| test10| test 2| very good
test3| test 2| test5| Good
test5| test 2| test3| Good
test16| test 2| test4| Good
];
Hi Constantin,
maybe
LOAD id,If(Index(description,'|',1)>0,Mid(description,Index(description,'|',1)+1),description) as description
Inline [
id,description
1,aaaaa,
2,bbbbb,
3,test1| test 2| test3| Good
4,test1| test10| test 2| very good
5,test3| test 2| test3| good
6,test5| test 2| test3| Good
7,test16| test 2| test3| good
];
Regards,
Antonio
Hi Constantin,
Try:
Table:
Load
if(WildMatch(Field,'*|*'),Trim(Right(Field,len(Field) - Index(Field,'|'))),Field) as Field;
LOAD * Inline [
Field
aaaaa
bbbbb
test1| test 2| test3| Good
test1| test10| test 2| very good
test3| test 2| test3| good
test5| test 2| test3| Good
test16 test 2| test3| good
];
gives:
Field |
---|
aaaaa |
bbbbb |
test 2| test3| Good |
test 2| test3| good |
test3| good |
test10| test 2| very good |
Cheers
Andrew
Well done! Many Thanks