Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
santharubban
Creator III
Creator III

QV is populating leading '0'

QV is populating a leading '0' when loading the data from database. In the database there is no leading '0' while pulling into QV leading '0' is populating.

8 Replies
simondachstr
Luminary Alumni
Luminary Alumni

It's a formatting issue - try playing around with Text() and Num() while loading in the script, maybe also Trim()

santharubban
Creator III
Creator III
Author

using Num() its working fine but in some case there is leading '0' in database. In this case i need leading '0' in QV also if i use Num() it is trim the leading '0'.

MK_QSL
MVP
MVP

Try something like below

Load

  Num(VALUE) as VALUE

Inline

[

  VALUE

  07810

  02540

  12354

  00796

];

Anonymous
Not applicable

you need an if statement to check if there is a leading zero and format it accordingly, or another way is may be you can look into dual function.

MK_QSL
MVP
MVP

One more

Load

  NUM(RIGHT(VALUE,Len(VALUE)-FindOneOf(VALUE,'123456789')+1),'####0') as NEWVALUE, VALUE as VALUE

Inline

[

  VALUE

  07810

  02540

  12354

  00796

];

maxgro
MVP
MVP

try

text(value)

simondachstr
Luminary Alumni
Luminary Alumni

I haven't tried it but what about something like this

If(Text(X)=Num(X),Num(X),Text(X))

ashfaq_haseeb
Champion III
Champion III

Hi,

Try this

replace(ltrim(replace(yourfield, '0', ' ')), ' ', 0) as NewField

Regards

ASHFAQ