Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
manoranjan_d
Specialist
Specialist

spliting the field value

Hi all,

I want to split the field value in to several fiedl

below is the sample and output pls let me know how to do this in the qv script

 

Field name1
1001/1002/1003/1004 - 1005/1006 - Available ( 100% )

output

 

f1f2f3f4f5f6f7f8
100110021003100410051006 Available

1.0

note: last field percentage has to be calculated example 100% is 100/100 =1 and it shd be in 1.0 value

1 Solution

Accepted Solutions
its_anandrjs

Did you try this way

LOAD

SubField(Trim(Str),'/',1) as f1,

SubField(Trim(Str),'/',2) as f2,

SubField(Trim(Str),'/',3) as f3,

SubField(Replace(Trim(Str),' - ','/'),'/',4) as f4,

SubField(Replace(Trim(Str),' - ','/'),'/',5) as f5,

SubField(Replace(Trim(Str),' - ','/'),'/',6) as f6,

SubField(SubField(Replace(Trim(Str),' - ','/'),'/',7),' ',-4) as f7,

SubField(Trim(Str),' ',7) as f8,

Replace(Trim(Str),' - ','/'),*;

LOAD * Inline

[

Str

1001/1002/1003/1004 - 1005/1006 - Available ( 100% )

];

For percentage, you can use 100% as it is.

View solution in original post

17 Replies
its_anandrjs

May be use subfiled here.

Anil_Babu_Samineni

Can you share real values atleast 5-10 rows to troubleshoot rather one line. Is that row is same for all ??

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
manoranjan_d
Specialist
Specialist
Author

format is same for all

jpenuliar
Partner - Specialist III
Partner - Specialist III

try looking at Subfield function to build your fields:

SubField - script and chart function ‒ Qlik Sense

manoranjan_d
Specialist
Specialist
Author

i used but its not working good because i have some pblm in that example space - brackets, percentage symbols

pls help me to give me in qvw files

jpenuliar
Partner - Specialist III
Partner - Specialist III

SubField([Field name1], '/',1) as F1,

SubField([Field name1], '/',2) as F2,

SubField([Field name1], '/',3) as F3,

SubField([Field name1], '/',4) as F4F5,

SubField([Field name1], '/',5) as F6F7F8

jpenuliar
Partner - Specialist III
Partner - Specialist III

worry about the F4 - F8 in the preceeding load.

again you can use subfield and or combination with purge function

its_anandrjs

Did you try this way

LOAD

SubField(Trim(Str),'/',1) as f1,

SubField(Trim(Str),'/',2) as f2,

SubField(Trim(Str),'/',3) as f3,

SubField(Replace(Trim(Str),' - ','/'),'/',4) as f4,

SubField(Replace(Trim(Str),' - ','/'),'/',5) as f5,

SubField(Replace(Trim(Str),' - ','/'),'/',6) as f6,

SubField(SubField(Replace(Trim(Str),' - ','/'),'/',7),' ',-4) as f7,

SubField(Trim(Str),' ',7) as f8,

Replace(Trim(Str),' - ','/'),*;

LOAD * Inline

[

Str

1001/1002/1003/1004 - 1005/1006 - Available ( 100% )

];

For percentage, you can use 100% as it is.

jpenuliar
Partner - Specialist III
Partner - Specialist III

you can also force a Replace function to convert "-" to "/" :

Replace ‒ QlikView