Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Our next Qlik Insider session will cover new key capabilities. Join us August 11th REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
amiroh81
Creator
Creator

split text from field

Hi All,

I have a field that contains random text and I want to split the text into single words.

The text can be separated by spaces, commas, periods, etc.

I tried using SubField with a space separator but I only split the first word.

In addition, I was unable to separate more than one type of separator.

For example, I have the following sentence:

how are-you.doing today

The result I would like to have is:

how

are

you

doing

today

Thank you!

1 Solution

Accepted Solutions
rwunderlich
Luminary Alumni
Luminary Alumni

CharMap:

Mapping LOAD *, ' '

Inline [

char

.

,

-

] (delimiter is '\t');

data:

LOAD

SubField(MapSubString('CharMap', Input), ' ') as Word

Inline [

Input

how are-you.doing today

];

-Rob

http://masterssummit.com

http://qlikviewcookbook.com

View solution in original post

16 Replies
YoussefBelloum
Champion
Champion

Hi,

test:

LOAD *,

subfield(Replace(Replace(name,'-', ' '),'.',' '),' ',1) as String1,

subfield(Replace(Replace(name,'-', ' '),'.',' '),' ',2) as String2,

subfield(Replace(Replace(name,'-', ' '),'.',' '),' ',3) as String3,

subfield(Replace(Replace(name,'-', ' '),'.',' '),' ',4) as String4

Inline [

name

how are-you.doing today

];

vishsaggi
Champion III
Champion III

May be try this using Mapping load. You can add any special characters in the mapping table named Table1 as you go.

Table1:

Mapping LOAD * INLINE [

Text, String

' ', @

-, @

., @

',', @

];

LOAD *, Subfield(replaceString, '@') AS NewField;

LOAD *, MapSubString('Table1', Text) AS replaceString INLINE [

Text

how are-you.doing today

];

YoussefBelloum
Champion
Champion

Great !

antoniotiman
Master III
Master III

Try this

LOAD SubField(SubField(SubField(Field,' '),'.'),'-') as Field

rwunderlich
Luminary Alumni
Luminary Alumni

CharMap:

Mapping LOAD *, ' '

Inline [

char

.

,

-

] (delimiter is '\t');

data:

LOAD

SubField(MapSubString('CharMap', Input), ' ') as Word

Inline [

Input

how are-you.doing today

];

-Rob

http://masterssummit.com

http://qlikviewcookbook.com

View solution in original post

YoussefBelloum
Champion
Champion

much greater

vkish16161
Creator III
Creator III

Viswarath's solution is the best of the lot. It will work.

amiroh81
Creator
Creator
Author

Thank you all.

Is there a way to make the separation in the model itself and not in the script?

where  can i read about mapping load?