Trying to check if a number field has anything other than 0 following the dot.
So 50.10 would have 10
50.00 would have 0 etc
Vaguely remember a rounding function but that might have been in R83 or another flavour
Trying to check if a number field has anything other than 0 following the dot.
So 50.10 would have 10
50.00 would have 0 etc
Vaguely remember a rounding function but that might have been in R83 or another flavour
Based on the information you provided, I would handle it as a string. The problem with doing it mathematically is that it loses the trailing 0s, which you appear to want based on your criteria and expected output.
If you know the precision (which you might because generally these things are stored as integers with a conversion applied to it display the decimal point) you can just take the last X Characters of the value using the [X] notation, or if you don't you could use FIELD to get everything after the ".", which is probably safer. If you need that to be an actual number at the other end just multiply the value by one, which will keep you 10 and make your 00 a 0.
TEST.VAL.1 = "50.10"
TEST.VAL.2 = "50.00"
TEST.VAL.3 = "50.1230"
CRT MOD(TEST.VAL.1,1) ;* returns 0.1
CRT MOD(TEST.VAL.2,1) ;* returns 0
CRT MOD(TEST.VAL.3,1) ;* returns 0.123
CRT TEST.VAL.1[2] ;* returns 10
CRT TEST.VAL.2[2] ;* returns 00
CRT TEST.VAL.3[2] ;* returns 30
CRT FIELD(TEST.VAL.1,".",2) ;* returns 10
CRT FIELD(TEST.VAL.2,".",2) ;* returns 00
CRT FIELD(TEST.VAL.3,".",2) ;* returns 1230
END
Good Luck!
There are many ways of doing it. One way is this:
NUMBER = 50.10
RESULT = FIELD(NUMBER,'.',2) ;* returns 10