Page 1 of 1 1
Topic Options
#79422 - 2003-01-13 11:29 AM FormatNumber() returns "" when value is 0
Lee Wilmott Offline
Starting to like KiXtart

Registered: 2002-09-17
Posts: 106
Loc: Bristol, UK
I am using KiX version 4.20 RC1 - however this occurs since version 4.11.

I want to return a number that has been formatted to 0 decimal places...

The following code ....
code:
? FormatNumber(1234567, 0, 0, False, -2)
? FormatNumber(1234, 0, 0, False, -2)
? FormatNumber(1, 0, 0, False, -2)

returns
quote:
1,234,567
1,234
1

Which is what I would expect...

However...

code:
? FormatNumber(0, 0, 0, False, -2)

returns an empty string.

I had hoped that FormatNumber would have returned "0".

Lee

Top
#79423 - 2003-01-18 11:29 PM Re: FormatNumber() returns "" when value is 0
Anonymous
Unregistered


Hi Lee,

the behaviour you report is the way it was designed. I agree that one can argue about the correctness, but the main reason it works the way it does is because it is compatible with Visual Basic.

Let me know what you think.

Regards,

Ruud

Top
#79424 - 2003-01-20 10:40 AM Re: FormatNumber() returns "" when value is 0
Lee Wilmott Offline
Starting to like KiXtart

Registered: 2002-09-17
Posts: 106
Loc: Bristol, UK
Ruud,

Many thanks for your reply.

I have just wrote the following VBScript...
code:
WScript.Echo FormatNumber(0,0)

and found that this did return "0".

I realise that this is VBScript, which maybe different from VisualBASIC itself. Unfortunately I don't have a copy of VisualBASIC to try this on.

My personal view is that KiX should return "0" in this situation - however, I must admit that before I posted my original post I didn't attempt to test this with VisualBASIC.

Lee

Top
#79425 - 2003-01-22 02:15 PM Re: FormatNumber() returns "" when value is 0
Lee Wilmott Offline
Starting to like KiXtart

Registered: 2002-09-17
Posts: 106
Loc: Bristol, UK
I must be having one of my dull moments! I really don't know what happened during my testing - but something fundamental broke down.

I cannot find a problem either.

Sorry for wasting everyones time!

Lee

Top
#79426 - 2003-01-22 03:04 PM Re: FormatNumber() returns "" when value is 0
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
You're welcome Lee !

As it is a really slow day here (all scripts done, nothing new happens) I won't blame you on wasting time [Wink]
_________________________



Top
#79427 - 2003-01-22 03:09 PM Re: FormatNumber() returns "" when value is 0
Lee Wilmott Offline
Starting to like KiXtart

Registered: 2002-09-17
Posts: 106
Loc: Bristol, UK
Cheers Jochen,

My original post was dated 13th Jan...I can't believe kixtart.org's regulars didn't pick me up on my mistake earlier - you guys are usually on the ball!

Don't get me wrong, I'm not trying to blame my mistake on everyone else - honest!!! [Smile] [Smile]

Lee

Top
#79428 - 2003-01-22 03:12 PM Re: FormatNumber() returns "" when value is 0
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
hmmm ... now that I think it over , I am to blame !

Wasn't it me that supposed to report this as a bug in your first topic ?

[Big Grin]
_________________________



Top
#79429 - 2003-01-22 03:17 PM Re: FormatNumber() returns "" when value is 0
Lee Wilmott Offline
Starting to like KiXtart

Registered: 2002-09-17
Posts: 106
Loc: Bristol, UK
Oh yeah, I forgot that!

Yeah, it's all your fault!!! [Big Grin] [Big Grin] [Big Grin]

[Smile] You made me look a fool! [Smile]

Lee

Top
Page 1 of 1 1


Moderator:  ShaneEP, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1636 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.056 seconds in which 0.024 seconds were spent on a total of 12 queries. Zlib compression enabled.