Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Split a string in numerical and alphabetical chars?

Hello,

i have a question, have a field witch contains alphab. and numerical values and i want to split the string in the value field like this.

An examlpe:

NoValue
11A0204
213AB0435
35O6845

This is how the table should look like:

NoValueValue2Value3
11A0204A0204
213AB0435AB0435
35O6845O6845

I tried a a mixture of findvalueof(), subfield() etc. But it doesnt work.

The value fiel has always the same form:

[1 or 2 num. chars][1 or 2 alphab. chars][4 num chars]

I should add that the alphab. values are limited. It can only have the value e.g. A,AB,O.

Is it possible to load the only the alphab. chars out of the value in the value2 field and then the the num. chars?

This would be helpful. 

Does someone has a clue or a hint for me? Thank you in advance!

1 Solution

Accepted Solutions
Sokkorn
Master
Master

Hi patryk1984,

Try this:

[Data]:

LOAD * INLINE [

No,    Value

1,    1A0204

2,    13AB0435

3,    5O6845];

QUALIFY * ;

[Data2]:

LOAD

    *,

    PurgeChar(Value,'0123456789')    AS [Value2],

    SubField(Value,PurgeChar(Value,'0123456789'),2)    AS [Value3]

RESIDENT Data;

You can do it with expression also:

     Value2: PurgeChar(Value,'0123456789')

     Value3: SubField(Value,PurgeChar(Value,'0123456789'),2))

Untitled.jpg

Hope this help.

Regards,

Sokkorn

View solution in original post

2 Replies
Sokkorn
Master
Master

Hi patryk1984,

Try this:

[Data]:

LOAD * INLINE [

No,    Value

1,    1A0204

2,    13AB0435

3,    5O6845];

QUALIFY * ;

[Data2]:

LOAD

    *,

    PurgeChar(Value,'0123456789')    AS [Value2],

    SubField(Value,PurgeChar(Value,'0123456789'),2)    AS [Value3]

RESIDENT Data;

You can do it with expression also:

     Value2: PurgeChar(Value,'0123456789')

     Value3: SubField(Value,PurgeChar(Value,'0123456789'),2))

Untitled.jpg

Hope this help.

Regards,

Sokkorn

Not applicable
Author

Thank you very much!

It works perfectly!