Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Obsyky
Contributor III
Contributor III

Right returns nothing

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 !

Labels (1)
1 Solution

Accepted Solutions
sidhiq91
Specialist II
Specialist II

@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;

View solution in original post

11 Replies
sidhiq91
Specialist II
Specialist II

@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
Contributor III
Contributor III
Author

That's almost it.

If I have "A1" and "A01" it turns me 01 for both but it's not the same for me 🙂

sidhiq91
Specialist II
Specialist II

@Obsyky  sorry I did not get that. Did it not resolve your issue yet?

Obsyky
Contributor III
Contributor III
Author

I get this with your code :

Obsyky_0-1656678161984.png

 

I want this :

A01 A 01
A1 A 1
Obsyky
Contributor III
Contributor III
Author

The problem comes directly from Qlik which for him 01 = 1, except that not for me. I'll have to understand why

sidhiq91
Specialist II
Specialist II

@Obsyky  Otherwise you are good with the solution right? If yes please accept it as a solution.

Gui_Approbato
Creator III
Creator III

The function Keepchar would work for you as well:

VALUELETTER:
LOAD
Keepchar(VALUE,'ABCDEFGHIJKLMNOPQRSTUVWXYZ') as Letter,
Keepchar(VALUE,'0123456789') as Number
FROM Source...;

https://help.qlik.com/en-US/sense/May2022/Subsystems/Hub/Content/Sense_Hub/Scripting/StringFunctions...

 

Obsyky
Contributor III
Contributor III
Author

So my problem is not really solved 😞

Obsyky
Contributor III
Contributor III
Author

I can't use Keepchar because I have value like H0H for example