Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join this live chat April 6, 10AM EST - QlikView to Qlik Sense REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
gsrchowdary
Contributor
Contributor

Splitting string into coloumns

Hi Friends,

I have a string like b-bghy-gnhytr-df-fgt.Need to split into 5 coloumns.

As well its size is not fixed..

Can any one help on this..

10 Replies
consenit
Partner
Partner

Hi there.

Look up the SubField() string function.

Kind regards,

Ernesto.

saurabh5
Creator II
Creator II

hi shiva,

As Ernesto mentioned use subfield function, below is script which will help you split into 5 columns

trigger:

load * inline [
word, number
b-bghy-gnhytr-df-fgt, 1

]
;

trigger2:
load number,
SubField(word,'-',1) as one,
SubField(word,'-',2) as two,
SubField(word,'-',3) as three,
SubField(word,'-',4) as four,
SubField(word,'-',-1) as five
resident trigger;


maxgro
MVP
MVP

RESULT

1.png

SCRIPT

a:

load * inline [

word, number

b-bghy-gnhytr-df-fgt, 1

];

b:

load number,

SubField(word,'-') as newfield

resident a

;

MarcoWedel

Hi,

one solution could be:

QlikCommunity_Thread_146373_Pic1.JPG

tabStrings:

Generic

LOAD RecNo() as %ID,

    'Sub'&Autonumber(RowNo(),RecNo()) as ColNo,

    SubField(string,'-') as substring

Inline [

string

b-bghy-gnhytr-df-fgt

sdf-sfdsfd-sdf-sdf-sf

sdfs-sfd-sdf-sf

egr-rht-tzj

tjt-iuk

wre

wrer-retz-zu-wre-tzo

zuk-rt-we-jhk-fh-etr

];

hope this helps

regards

Marco

rustyfishbones
Master II
Master II

Use SUBFIELD Function like below image

2014-12-20_1147.png

alkesh_sharma
Creator III
Creator III

Use SubFiled() Function

MarcoWedel

Any luck testing the proposed solutions so far?

gsrchowdary
Contributor
Contributor
Author

Hi yes i tried and its working

MarcoWedel

Hi,

good to hear.

Please close this thread.

thanks

regards

Marco