Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Simple question > loading data (numbers) with prefix

I need to fill out the numbers in the load script to 4 positions. In my datasource the numbers are shown as 3 and 4 digits (e.g. 310 and 1340). I want to add an extra 0 for the 3-digit numbers: 0310 at the dataload, so all numbers will be shown as 4-digit numbers in my QV-app.

What is the correct syntax to do this?

1 Solution

Accepted Solutions
Not applicable
Author

Hi Patrik,

This is my solution:


Load Date,
if(Len(Number) = 3, '0'&Number, Number) as Number;
LOAD * INLINE [
Date, Number
2/1/2009, 352
1/1/2009, 4562
1/3/2009, 698
];


I hope it helps you.

Best regards.

View solution in original post

3 Replies
Not applicable
Author

Hi Patrik,

This is my solution:


Load Date,
if(Len(Number) = 3, '0'&Number, Number) as Number;
LOAD * INLINE [
Date, Number
2/1/2009, 352
1/1/2009, 4562
1/3/2009, 698
];


I hope it helps you.

Best regards.

Not applicable
Author

Hi Patrick,

try the below:

temp1:
LOAD * INLINE [
F1
310
1420
];

NOCONCATENATE

temp2:
LOAD
num(F1,'0000') as F2
RESIDENT temp1;

DROP TABLE temp1;

Cheers, Lukas

Not applicable
Author

Thanks. This works perfect!