Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I have a problem with the right method which returns nothing.
To understand, here is my input table :
VALUE |
A15 |
B0 |
C85 |
F1 |
G89 |
What I would like to find as a table after:
LETTER | NUMBER |
A | 15 |
B | 0 |
C | 85 |
F | 1 |
G | 89 |
For this use :
VALUELETTER:
LOAD
Left(VALUE,1) as LETTER,
If(Len(VALUE) > 2,Right(VALUE,2),Right(VALUE,1)) as NUMBER
Resident TABLE
With this code I get this :
LETTER | NUMBER |
A | 15 |
C | 85 |
G | 89 |
Why right returns nothing when the length is two ????
Thanks !
@Obsyky Please see below. If it has resolved your issue, kindly like and accept as your resolution.
NoConcatenate
Temp:
Load * Inline [
VALUE
A15
B0
C85
F1
G89
];
NoConcatenate
Temp1:
Load *,
Left(VALUE,1) as Letter,
if(Len(VALUE)>0,Right(VALUE,len(VALUE)-1)) as Number
Resident Temp;
Drop table Temp;
Exit Script;
@Obsyky Please see below. If it has resolved your issue, kindly like and accept as your resolution.
NoConcatenate
Temp:
Load * Inline [
VALUE
A15
B0
C85
F1
G89
];
NoConcatenate
Temp1:
Load *,
Left(VALUE,1) as Letter,
if(Len(VALUE)>0,Right(VALUE,len(VALUE)-1)) as Number
Resident Temp;
Drop table Temp;
Exit Script;
That's almost it.
If I have "A1" and "A01" it turns me 01 for both but it's not the same for me 🙂
@Obsyky sorry I did not get that. Did it not resolve your issue yet?
I get this with your code :
I want this :
A01 | A | 01 |
A1 | A | 1 |
The problem comes directly from Qlik which for him 01 = 1, except that not for me. I'll have to understand why
@Obsyky Otherwise you are good with the solution right? If yes please accept it as a solution.
The function Keepchar would work for you as well:
VALUELETTER:
LOAD
Keepchar(VALUE,'ABCDEFGHIJKLMNOPQRSTUVWXYZ') as Letter,
Keepchar(VALUE,'0123456789') as Number
FROM Source...;
So my problem is not really solved 😞
I can't use Keepchar because I have value like H0H for example