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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Create a field extracting 'n' characters from another field

Hi,

I have a table with a field called 'description', it is a text field.

I would like to create another field into the same load called 'first_word'.

I suppose I need a function to count the position of the first blank, and then using a function to extract from the first position to the position counted before but how should I write so?.

LOAD

description

EXTRACT(description, FIND&COUNT(BLANK))  as first_word

from...

Thanks

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Try: subfield(description,' ',1) as first_word

It treats description as a list of strings separated by a space ' '. It returns the string before the first space because of the 1 as the last parameter.


talk is cheap, supply exceeds demand

View solution in original post

1 Reply
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Try: subfield(description,' ',1) as first_word

It treats description as a list of strings separated by a space ' '. It returns the string before the first space because of the 1 as the last parameter.


talk is cheap, supply exceeds demand