Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
f1 | f2 | f3 | f4 | f5 | f6 | f7 | f8 |
1001 | 1002 | 1003 | 1004 | 1005 | 1006 | 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
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.
May be use subfiled here.
Can you share real values atleast 5-10 rows to troubleshoot rather one line. Is that row is same for all ??
format is same for all
try looking at Subfield function to build your fields:
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
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
worry about the F4 - F8 in the preceeding load.
again you can use subfield and or combination with purge function
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.
you can also force a Replace function to convert "-" to "/" :