Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

Splitting the words in a field

I am having a qvd file having field name colors. This field is consist of accumulated records of color names

example RE, BLRE.. where BL and  RE is seperate color names. I want to split these names into another record and store in a temp .

Also i want to generate unique color ID for the new born records.

SPLIT.jpg

Tags (1)
1 Solution

Accepted Solutions
MVP
MVP

Re: Splitting the words in a field

Well now the requirement is clearer. Try like:

Load

       Mid(COLORS, (Iterno()-1)*2+1, 2) as NewCOLORS

From <>

While Len(COLORS)>=IterNo()*2;

6 Replies
MVP & Luminary
MVP & Luminary

Re: Splitting the words in a field

1. Are all the color names two characters?

2. Are all the possible color names known in advance?

-Rob

MVP
MVP

Re: Splitting the words in a field

Probably you need Subfield() function in combination with another string fucntion Left(). Try something like:

Load

          Subfield( Left(COLORS,2)& ';' &Mid(COLORS,2) , ';' ) as NewCOLORS

Not applicable

Re: Splitting the words in a field

Yes. Color Names are tow characters concatenated within one field (column)

And all the color names are known to me, I just want to split the word in two characters.

Thank you in advance

Not applicable

Re: Splitting the words in a field

Expected Result was

BUDPLPORVI  into   BU

                               DP

                               LP

                               OR

Source Code:

TEMP_COLOR:

LOAD CODE,

COLORS

Resident INVENTOR_QVD

Where COLORS <> '';

LOAD

Subfield( Left(COLORS,2)& ';' &Mid(COLORS,2) , ';' ) as NewCOLORS

Resident TEMP_COLOR;

Drop Table TEMP_COLOR;

result1.jpg

MVP
MVP

Re: Splitting the words in a field

Well now the requirement is clearer. Try like:

Load

       Mid(COLORS, (Iterno()-1)*2+1, 2) as NewCOLORS

From <>

While Len(COLORS)>=IterNo()*2;

Not applicable

Re: Splitting the words in a field

Thank You Very Much. Its really working