Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Shani1
Contributor II
Contributor II

add 0 to string

Hi,

 

i have a 19 million+ rows of data which i need to adjust in load script. But don't know how.

I have prodcts serials with different lengths and i need to add '0's on left side of sales Serials so this can become 30 characters

see the example below. 

how do i do that?

SaleSerialSystemSerial
CCCC8E53616C000000000000000000CCCC8E53616C
8E536121200000000000000000000008E5361212
Labels (1)
1 Solution

Accepted Solutions
vijayaganesh_s
Partner - Contributor III
Partner - Contributor III

Hello,

Please try the below code and method this will help you!

Table:
LOAD
SaleSerial,
REPEAT(0,30-LEN(SaleSerial))&SaleSerial AS SystemSerial;
LOAD * INLINE [
SaleSerial
CCCC8E53616C
8E5361212
];

This code will add 0s to the left side of the SaleSerial that you are expecting as SystemSerial.

View solution in original post

3 Replies
vijayaganesh_s
Partner - Contributor III
Partner - Contributor III

Hello,

Please try the below code and method this will help you!

Table:
LOAD
SaleSerial,
REPEAT(0,30-LEN(SaleSerial))&SaleSerial AS SystemSerial;
LOAD * INLINE [
SaleSerial
CCCC8E53616C
8E5361212
];

This code will add 0s to the left side of the SaleSerial that you are expecting as SystemSerial.

Shani1
Contributor II
Contributor II
Author

Thanks a lot, it seems to work 

 

vijayaganesh_s
Partner - Contributor III
Partner - Contributor III

You are welcome