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: 
Not applicable

Keeping the number format

Hi,

I have a file that imports the store numbers as 045, 001, 125 etc as 3 digit numbers

Once I have brought in the table the zeros at the front get dropped.

I tried a num#(STORE,'000') as StoreNo. but it doesnt keep that format

any ideas?

David

7 Replies
biester
Specialist
Specialist

Not applicable
Author

Hi David,

I faced a similar siiue reecntly for one of the mapping tables and here is what the work around I did.

>>In the SQl select, concatenated 'x' as prefix to the field (so nthat QV will treat all as string)

>> In the QVD load, excluded the first chharacter by right(field,len(field)-1)

--Arun

janbouwmans
Contributor II
Contributor II

I have the problem the other way around: If I import a number with trailer zero's from a flat file, the trailer zero's remain.

Importing : .....;000000000002000011;.... in the following statement :

Load num#(Item_Code; '#') as ItemCode

results in 000000000002000011

biester
Specialist
Specialist

Strange that you suggest your question as a solution for the original one...

Nevertheless: as solution to YOUR question you could use e.g.

num(Item_Code,'#.#0,00') as Item_Code

which would result in

2.000.011,00

Rgds,
Joachim

janbouwmans
Contributor II
Contributor II

Sorry to have put it up as a possible solution.

Using the num#() function should work, but it doesn't:

it seems that if there are trailerzero's the num function does not remove trailerzeros. I've done an extra test containing less trailer zero's and even then the num# - function does not remove trailer zero's.

biester
Specialist
Specialist

Note: num#() is an interpretation function. The formatting function is num()!

Rgds,
Joachim

janbouwmans
Contributor II
Contributor II

The num() function works, but only for strings up to 14 digits. This probably has to do with the 32-bits version that I am using

Regards, Jan