Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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:
No | Value |
---|---|
1 | 1A0204 |
2 | 13AB0435 |
3 | 5O6845 |
This is how the table should look like:
No | Value | Value2 | Value3 |
---|---|---|---|
1 | 1A0204 | A | 0204 |
2 | 13AB0435 | AB | 0435 |
3 | 5O6845 | O | 6845 |
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!
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))
Hope this help.
Regards,
Sokkorn
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))
Hope this help.
Regards,
Sokkorn
Thank you very much!
It works perfectly!