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: 
hkg_qlik
Creator III
Creator III

Add while loading

Hi,

I have a fieldname Employer_Code with different values such as 1133, 33001, 2211, 33223 ,...

Now I want to add 00 incase the code is four digit like 1133 and 0 if its five digit like 33001.

Regards,

H

1 Solution

Accepted Solutions
Not applicable

Num(Employer_Code,'00000') AS Employer_Code

View solution in original post

5 Replies
Not applicable

Num(Employer_Code,'00000') AS Employer_Code

Anonymous
Not applicable

Hi,

Answer:

if (left(Employer_Code,4) = '1133',

     '00' & Employer_Code,

     if (left(Employer_Code,5) = '33001',

          '0' & Employer_Code,

          Employer_Code

     )

)          as      New_Employer_Code

Kind regards,

Janusz

Not applicable

hi,

i don't know what your specific needs are but you can do something like this

=if(len(Employer_Code)=4,'Employer_Code'&00, if (len(Employer_Code)=5,'Employer_Code'&0) ))as something

if have not tried this but it might help you in the right direction

Regards,

cesaraccardi
Specialist
Specialist

Hi,

I think the best solution is the suggested by Felim with a little correction:

Num(Employer_Code,'000000') AS Employer_Code

This will automatically format the number to fill the leading zeros.

Regards,

Cesar

Not applicable

ahh yea I was appending a zero.... stupid me