Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
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..
Try using floor(A) instead to retrieve integers, or just format the numbers with an appropriate format code, maybe
num(A,'0')
Regard,
Stefan
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
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..
Its working Sweuhl.
But i had one doubt why it is not working with same field name ?
Thanks a lot.
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.
Thanks Swuehl.
It's Great !