Question
· Jul 26, 2016

overriding the logicalToDisplay() meothods

Cache 2015.2

I need to get a sort order stored in my database with mutiple decimal places, but I want the string stored and retrieved EXACTLY as I enter it. so if someone enters 700.3000 I don't want cache to treat it as a decimal and strip the trailing zeros storing it as 700.3

once it comes back, I want the sorting to sort AS STRINGS, again, none of that stripping training/leading zeros.

this ay, I can create local arrays in exactly the order they think? they created them

I realise I can add another decimal point at the end eg 700.3000. and then it would be treated as a string but the user doesn't need to be involved with this sort of work around

I've tried declaring them as %Decimals, %Floats, %Strings and everything truncates

whats the trick here ??

kev

Discussion (3)0
Log in or sign up to continue

Perhaps I'm not fully understanding what you are asking for, but why doesn't using a string datatype work for you?

SAMPLES>>create table kev (mynum varchar(10))
1.    create table kev (mynum varchar(10))

0 Rows Affected
statement prepare time(s)/globals/lines/disk: 0.0084s/2003/16386/0ms
          execute time(s)/globals/lines/disk: 0.0838s/46277/360501/0ms
---------------------------------------------------------------------------
SAMPLES>>insert into kev (mynum) values ('300.6000')
2.    insert into kev (mynum) values ('300.6000')

1 Row Affected
statement prepare time(s)/globals/lines/disk: 0.0108s/2772/28131/0ms
          execute time(s)/globals/lines/disk: 0.0002s/13/153/0ms
---------------------------------------------------------------------------
SAMPLES>>insert into kev (mynum) values ('200.100')
3.    insert into kev (mynum) values ('200.100')

1 Row Affected
statement prepare time(s)/globals/lines/disk: 0.0011s/49/2516/0ms
          execute time(s)/globals/lines/disk: 0.0007s/3/153/0ms
---------------------------------------------------------------------------
SAMPLES>>insert into kev (mynum) values ('643.1230')
4.    insert into kev (mynum) values ('643.1230')

1 Row Affected
statement prepare time(s)/globals/lines/disk: 0.0006s/49/2526/0ms
          execute time(s)/globals/lines/disk: 0.0001s/3/153/0ms
---------------------------------------------------------------------------
SAMPLES>>select mynum from kev
5.    select mynum from kev

mynum
300.6000
200.100
643.1230

3 Rows(s) Affected
statement prepare time(s)/globals/lines/disk: 0.0622s/45809/254912/0ms
          execute time(s)/globals/lines/disk: 0.0002s/16/523/0ms
---------------------------------------------------------------------------
SAMPLES>>cos zw ^User.kevD
^User.kevD=3
^User.kevD(1)=$lb("300.6000")
^User.kevD(2)=$lb("200.100")
^User.kevD(3)=$lb("643.1230")