Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
alis2063
Creator III
Creator III

set

Words Length from string:

How we get the length of word from the string.i.e

i have string as below,

> this is a car.

so i am expecting the result as 4 2 1 3

thanks in Advanced .

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Maybe something along this (INLINE table is only for demonstration, use your table source instead):

LOAD string, CONCAT(numChar,' ',index) as numChars

GROUP BY string;

LOAD *, LEN(word) as numChar;

LOAD *, SUBFIELD(string,' ',iterno()) as word, iterno() as index

INLINE [

string

this is a car

]

WHILE iterno() <= SUBSTRINGCOUNT(string, ' ')+1;

string numChars
this is a car4 2 1 3

View solution in original post

3 Replies
swuehl
MVP
MVP

Maybe something along this (INLINE table is only for demonstration, use your table source instead):

LOAD string, CONCAT(numChar,' ',index) as numChars

GROUP BY string;

LOAD *, LEN(word) as numChar;

LOAD *, SUBFIELD(string,' ',iterno()) as word, iterno() as index

INLINE [

string

this is a car

]

WHILE iterno() <= SUBSTRINGCOUNT(string, ' ')+1;

string numChars
this is a car4 2 1 3
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

and if you want a chart expression:

=$(=concat( 'Len(Subfield(''this is a car'','' '',' & ValueLoop(1, SubStringCount('this is a car',' ')+1) & '))' , ' & '' '' & '))

sillytricksdepartment‌


talk is cheap, supply exceeds demand
alis2063
Creator III
Creator III
Author

can we use it as variable  for column in qlikview ui.