Formatting Numbers correctly

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

Formatting Numbers correctly

Postby rochard » Tue Oct 26, 2004 7:04 pm

In my query I have the following:

sum(T1.RoomTotal)


I have been trying, unsuccessfully, to format this number as either to 2 decimal places OR as an integer value. I've tried using math.floor() and mathround() for the integer, i.e.,
math.floor(sum(T1.RoomTotal))
math.round(sum(T1.RoomTotal))


and for the decimal number
number.toFixed(sum(T1,RoomTotal),2)


but none of these work and in fact, stop the query running successfully in that no results show.

Obviously I am using the wrong function or positioning it incorrectly so if somebody could correct me, I would be very grateful. TIA
Michael Rochard
rochard
 
Posts: 142
Joined: Thu Jan 29, 2004 12:11 am

Postby maarten » Tue Oct 26, 2004 8:55 pm

here's a link that gives you easy access to syntax of various databases.

http://sqlzoo.net/howto/source/s.pl.htm?file=tip177276&e=postgres
Maarten Berkenbosch
User avatar
maarten
 
Posts: 797
Joined: Wed Apr 23, 2003 10:52 pm
Location: Amersfoort, Netherlands

Postby Harry Catharell » Tue Oct 26, 2004 10:59 pm

Hi Michael,

Perhaps this thread may help you :

http://forum.servoy.com/viewtopic.php?t=2034&highlight=

Cheers

Harry
Harry Catharell
 
Posts: 812
Joined: Fri Sep 26, 2003 10:23 am
Location: Milton Keynes, England

Number Formatting

Postby rochard » Wed Oct 27, 2004 4:22 am

Thanks, Harry and Maarten for your responses.
Michael Rochard
rochard
 
Posts: 142
Joined: Thu Jan 29, 2004 12:11 am


Return to Programming with Servoy

Who is online

Users browsing this forum: No registered users and 31 guests