Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
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
Highlighted
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
Highlighted
Partner
Partner

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

 

 

Highlighted
Specialist
Specialist

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

 

Highlighted
Creator III
Creator III

Use repeat function like...

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

 

Thanks.

Vikky

View solution in original post

Highlighted
Specialist
Specialist

Thanks Vikky,

amazing answer. This is what I needed.

Thanks a lot.

 

Neville

Highlighted
Partner
Partner

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,

 

 

 

 

Plees ekskuse my Swenglish and or Norweglish spelling misstakes
Highlighted
Creator III
Creator III

Welcome !

Highlighted
Specialist
Specialist

Thanks 

Vegar

Fine answer too.

Highlighted
Specialist
Specialist

 

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

Highlighted
Specialist
Specialist

Thanks Jduenyas

 

Hlpful answer too