Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

seperate code from description

I would like to remove a color code from its total description

Our color description is 001 Black and I would like to create a field only showing Black.

I tried to exclude this via the left function, but this leads not to the correct results.

thanks for your help in advance

Patrick

8 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

If all colors follow that pattern: number followed by the text, you should be able to:

=mid(myfield, index(myfield, ' ')+1)

-Rob

maxgro
MVP
MVP

if ' ' is always there

=subfield('001 Black', ' ', 2)

replace '001 Black' with your field

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

What if the color is "002 Dark Blue"?

maxgro
MVP
MVP

Dark

or

Error

?

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I meant to point out that the subfield() method wouldn't work with a multi-word color

-Rob

sebastiandperei
Specialist
Specialist

There are different posibilities, based on your data.

If your format is everytime: [code][space][color], I guess Massimo and Rob solutions are what you need (if you have multi-word colours, only Rob's one works)

If you haven't everytime ONE space between code and colour, you could use Mid(Purgechar(field,'0123456789'),1)

I think that if you send the different types of values you have, it wil be easier.

maxgro
MVP
MVP

yes, for a one word color my answer works, for a multi-word it doesn't, it's an Error

Not applicable
Author

Dear Rob,

this was very helpful input. It solved my problem.

Many thanks

Patrick