Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
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

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Well now the requirement is clearer. Try like:

Load

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

From <>

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

View solution in original post

6 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

1. Are all the color names two characters?

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

-Rob

tresesco
MVP
MVP

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
Author

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
Author

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

tresesco
MVP
MVP

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
Author

Thank You Very Much. Its really working