Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Num function

Hi all,

I am trying below script lines in my application to fetch the field values like integer numbers.

i.e; A = 1,2,3 and B = 1,2,3,4,5,6

But it is not getting like integer format, just it is displaying like decimal format.

T1:

LOAD * Inline

[A,B

1.00000,1.00000

2.00000,1.00000

3.00000,1.00000

              ,4.00000

              ,5.00000

              ,6.00000];

T2:

LOAD RowNo() as MK,

     Num(A) as A ,

     Num(if(Len(B)>0, B)) as B

Resident T1;

DROP Table T1;

Is there any mistake in above script.

Thanks in advance.

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Strange, if you just rename the fields, like

  

T2:

LOAD RowNo() as MK,

     Num(A) as A 1,

     Num(if(Len(B)>0, B)) as B1

Resident T1;

it seems to work..

View solution in original post

6 Replies
swuehl
MVP
MVP

Try using floor(A) instead to retrieve integers, or just format the numbers with an appropriate format code, maybe

num(A,'0')

Regard,

Stefan

Not applicable
Author

Hi swuehl,

I tried using both but not able to retrieve integer values.

T2:

LOAD RowNo() as MK,

     Num(A,'0') as A ,

     Num(if(Len(B)>0, B),'0') as B

Resident T1;

(and)

T2:

LOAD RowNo() as MK,

     Floor(A) as A ,

     Floor(if(Len(B)>0, B)) as B

Resident T1;

Thanks

swuehl
MVP
MVP

Strange, if you just rename the fields, like

  

T2:

LOAD RowNo() as MK,

     Num(A) as A 1,

     Num(if(Len(B)>0, B)) as B1

Resident T1;

it seems to work..

Not applicable
Author

Its working Sweuhl.

But i had one doubt why it is not working with same field name ?

Thanks a lot.

swuehl
MVP
MVP

Not quite sure. I think the format of field A from your input table is dominating also the format of Field A in your second table, probably because of some internal data storing issues.

You can also use this:

T1:

LOAD recno() as MK, num(A) as A, num(B) as B Inline

[A,B

1.00000,1.00000

2.00000,1.00000

3.00000,1.00000

               ,4.00000

               ,5.00000

               ,6.00000]

;

to get correct format in one run.

Not applicable
Author

Thanks Swuehl.

It's Great !