Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
0li5a3a
Creator III
Creator III

Extract the data from a subfiled

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

1 Solution

Accepted Solutions
antoniotiman
Master III
Master III

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

View solution in original post

4 Replies
vinieme12
Champion III
Champion III

<<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

];

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
antoniotiman
Master III
Master III

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

effinty2112
Master
Master

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

0li5a3a
Creator III
Creator III
Author

Well done! Many Thanks