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: 
nevilledhamsiri
Specialist
Specialist

To add zeros in front of fields in order them to be with a length of 6

Hi Members,

Please help me to achieve the said out put. As for my data, I need both EPF Number & Emp fields to be with 6 digit lengths & as long as the length of the  record remains less than 6 digits, I need zeros to make it 6 digit lengths.

Eg   3988 to be appeared as 003988 ,once data are loaded. The excel carries this length but once loaded it turns to be a number resulting all zeros getting dropped.

Thanks

 

Neville

1 Solution

Accepted Solutions
vikramv
Creator III
Creator III

Use repeat function like...

Repeat('0', 6-len(EPF)) & EPF   as  EPF

 

Thanks.

Vikky

View solution in original post

9 Replies
dplr-rn
Partner - Master III
Partner - Master III

change your load script to

LOAD BR_Code, Month, EPF_NO, ''&EMP_NO as EMP_NO, [Employee_ Name], PAID

 

basically force engine to recognize that column as string

 

 

nevilledhamsiri
Specialist
Specialist
Author

Does this add zeros in front of emp_no to appear it with 6 digit lengths?

Could you add more details because I have no idea how to make it

 

vikramv
Creator III
Creator III

Use repeat function like...

Repeat('0', 6-len(EPF)) & EPF   as  EPF

 

Thanks.

Vikky

nevilledhamsiri
Specialist
Specialist
Author

Thanks Vikky,

amazing answer. This is what I needed.

Thanks a lot.

 

Neville

Vegar
MVP
MVP

That's a neat one @vikramv 

I usually do like this

Right('000000'& EPF, 6)  as  EPF,

Or like this if I know that EFT is an integer.

num(EPF, '000000') as EPF,

 

 

 

 

vikramv
Creator III
Creator III

Welcome !

nevilledhamsiri
Specialist
Specialist
Author

Thanks 

Vegar

Fine answer too.

jduenyas
Specialist
Specialist

 

Right('000000'+EPF,6) AS EPF

nevilledhamsiri
Specialist
Specialist
Author

Thanks Jduenyas

 

Hlpful answer too