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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

String functions help

Hi All,

Is it possible to read the last two words of a string as a field?

e.g if the string is ABC DEF GHI.xls, then DEF GHI should be stored in a field.

Thanks,

Asma

Labels (1)
7 Replies
sunny_talwar
MVP
MVP

You can try this may be:

=SubField('ABC DEF GHI', ' ', 2) & ' ' & SubField('ABC DEF GHI', ' ', 3)

ganeshreddy
Creator III
Creator III

Hi Asma,

try

right('ABC DEF GHI',7) as NewField,

and PFA

Cheers,

Ganesh.

MarcoWedel
MVP
MVP

Mid(string,Index(string,' ', -2)+1) as NewField

mohammadkhatimi
Partner - Specialist
Partner - Specialist

Hie..


SubField(trim(field name),' ',2)&''&SubField(trim(field name),' ',3)


Hope this will help you...


Regards,

Mohammad

sunilkumarqv
Specialist II
Specialist II

right(string,Index(string,' ', 2)) as NewField

Not applicable
Author

Hi Asma,

for a field with an variable number of words in it, the below should work for you (a simple subfield 2 & 3 wouldn't work with a 4 word value )

subfield('ABC DEF GHI JKL', ' ',SubStringCount('ABC DEF GHI JKL',' ')) & ' ' &

subfield('ABC DEF GHI JKL', ' ',SubStringCount('ABC DEF GHI JKL',' ')+1)

hope that helps

Joe

Not applicable
Author

you can also try this: Mid('ABC DEF GHI',FindOneOf('ABC DEF GHI',' *')) as new field;

See below instructions on how to add to script editor

in the script editor add this:

load

Mid(F1,FindOneOf(F1,' *')) as F2;

LOAD * INLINE [

     F1

     ABC DEF GHI

];