Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Pasturuti
Contributor
Contributor

"Looks like Magic" - Automatic Conversion to Number if you have the prefix "R" in the string.

Looks like Magic

I was loading a table from a database with VARCHAR(3) Type Code  and VARCHAR(50) Type Description only, there were several codes, for example: 001, 002, 032, C01, G44, R32, 055;

I noticed that while loading some codes they disappeared and others got duplicated, take the test below and draw your own conclusions.

Make the Script:

Table:
LOAD * Inline [
ID , TEXTO
'032','TEXTO 32'
'A32','TEXTO A'
'C32','TEXTO C'
'H32','TEXTO H'
'M32','TEXTO M'
'R32','TEXTO R'
'S32','TEXTO S'
];

After loading note that Code R32 turns to 032, leaving my code duplicated.

If code R32 was before 032, it would turn into R32.

Cade o Códgio R32?Cade o Códgio R32?

 
 
 

From the Data Model Viewer we can see that it changed at the time of loading.

This occurs if the code is already loaded, in my example '032'.

 

 

 

 

 

 

 

 

 

 

 

The only help item I found was this one, just because it's just the letter "R":

Help QlikHelp Qlik

 

Correcting:

To prevent this from happening use the TEXT Function:

Table:
LOAD
       text(ID) as ID,
       text(TEXTO) as TEXTO
Inline [
ID , TEXTO
'032','TEXTO 32'
'A32','TEXTO A'
'C32','TEXTO C'
'H32','TEXTO H'
'M32','TEXTO M'
'R32','TEXTO R'
'S32','TEXTO S'
];

Viewing:

Visualização Modelo de DadosVisualização Modelo de Dados

I wonder if anyone came across this as it took me a few hours to sort it out?

Thanks

 

Labels (2)
0 Replies