Actually, Excel does NOT keep the trailing zero, but simply displays it that 
way.  The underlying data (what you get if you retrieve the data from the cell 
programmatically) is "12.2". Or worse, it could be the result of a division, 
and you could get 12.2033333333333, but you told Excel to display 2 decimal 
places.

You're right that the original explanation was that we were transforming MM.MM, 
but this raises two concerns. First, what happens with numbers greater than 
99.99? The user gave me a definition and I'm always going to either clarify 
VERY CAREFULLY or assume that they are making all kinds of assumptions. In 
short, there are some reasonable human assumptions that you should always 
account for.  Secondly, even if the customer intends that we always get "12.20" 
stored, someone, someday will look at the data and say to themselves, 'Hey, I 
can store "12.2"! That will save space, and the decimal makes it clear what the 
number is!' and they'll make a change that breaks your code.

I always try to account for reasonable assumptions.  E.g: 112.2 and 112.20 and 
0112.2000 are the same number. Even a child knows that.  If my code isn't at 
least as smart as a 5th grader, it's too stupid to go to production.  
ICONV(var,"MDn") will always give you a number with 'n' implied decimals, and 
on most MV platforms will round for you (check your platform - don't assume 
this one, either!) INT((var * 100) + 0.5) do the same to 2 decimal places (in 
this case 'n' is the number of zeros you are multiplying your number by.) 
Simply stripping the decimal out is a very brittle solution, and one I'd never 
accept in a code review.

-----Original Message-----
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson
Sent: May-08-13 9:38 AM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] Illegal use of the file, select, cursor, BCI, Socket, HTTP, 
XML, SCTX , MQS, SOAP or database variable.


 No.... when I tell Excel that a column is dollars, or time, it always leaves 
the trailing zero.
What are you doing that makes it remove that?






-----Original Message-----
From: George Gallen <ggal...@wyanokegroup.com>
To: U2 Users List <u2-users@listserver.u2ug.org>
Sent: Wed, May 8, 2013 9:36 am
Subject: Re: [U2] Illegal use of the file, select, cursor, BCI, Socket, HTTP, 
XML, SCTX , MQS, SOAP or database variable.


They call it Excel!

-----Original Message-----
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org]
On Behalf Of Wjhonson
Sent: Wednesday, May 08, 2013 12:31 PM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] Illegal use of the file, select, cursor, BCI, Socket, HTTP, 
XML, SCTX , MQS, SOAP or database variable.

Haha yes, but again, the original request...
If a client sent me "dollar" figures where 12.2 was supposed to mean 12.20 I 
would go like ... what kind of system do you run where 12.2 means 12.20 ?

I'm assuming that a file you want to read into a Pick system, with embedded 
MM.MM dollars is coming from an outside source.  I can't recall ever seeing 
12.2 used for 12.20 outside of a Pick system.




_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to