Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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 - Creator II
Partner - Creator II

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?

Anonymous
Not applicable
Author

Hi yes i tried and its working

MarcoWedel

Hi,

good to hear.

Please close this thread.

thanks

regards

Marco