Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Leading zeros

Hi guys.

I need help on an issue. I have a view in sql server that brings two records 014801 and 14801.

These are two different items.When i  make a select from that view on a qvw the result is that it brings only one of the records.

I have tried convert(varchar,item) but it didnt work. Can anyone help?

1 Solution

Accepted Solutions
sivarajs
Specialist II
Specialist II

This might be you are looking for

View solution in original post

12 Replies
rajni_batra
Specialist
Specialist

try to convert it into text by using text(records) then it would treat both values differently

Not applicable
Author

replace(ltrim(replace([FIELD], '0', ' ')), ' ', 0) as FIELD

sudeep_d
Partner - Creator
Partner - Creator

hi,

if 014801 is in field name 'item',then

replace(ltrim(replace(item,'0',' ')),' ','0') as item

sudeep

Not applicable
Author

What i do is that I store the result of the select into a qvd and then I load the qvd using the text(item) but it doesnt work correctly. It brings only the 014801.

Not applicable
Author

Do not use the text function - use the following formula to get rid of leading zeros

replace(ltrim(replace([FIELD], '0', ' ')), ' ', 0) as FIELD

Not applicable
Author

The problem is that I want to show both values 014801 and 14801.

If I use the replace function , it will give me only the 14801.

Not applicable
Author

Im not too sure why you would want to use both fields

But you can use the replace function and the other way and have them named differently

Not applicable
Author

014801 and 14801 are two different records. I want to show them both along with quantities. What happens is that the sql result is 014801 with quantity 100 and 14801 with quantity 200. QV shows 014801 with quantity 300.

sudeep_d
Partner - Creator
Partner - Creator

hi,

if u want to bring 1 as number and other as text then,

if(item=14801,'14801',item)

result:

14801

           014801

sudeep