Set a default format for a database table column

Questions and answers regarding general SQL and backend databases

Set a default format for a database table column

Postby joe26 » Tue Oct 24, 2017 1:55 am

I have not been successful using the default format for a table column.

I'd like 20.0 and 5.0 and 874.0 to be displayed as integers.
Prior to storing the TEXT field, I use Math.floor(x) to define an integer and it stubbornly shows a trailing decimal zero.

No luck in finding from where the trailing real number info is coming, but thought I'd just use the default format. Um, with no success.

thanks,
--Joe.
Servoy 7.4.8
joe26
 
Posts: 172
Joined: Wed Jun 19, 2013 10:30 pm

Re: Set a default format for a database table column

Postby ROCLASI » Tue Oct 24, 2017 7:19 am

Hi Joe,


To display a number without the trailing zero you use the format property on the form element.
For example you set it to #### if you want a to show (max) 4 digits without any decimals.

Hope this helps.
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Re: Set a default format for a database table column

Postby joe26 » Tue Oct 24, 2017 8:45 am

Hi Robert,

That's what was expected. But setting the table to a default format, ####, causes only single digit numbers to show.

My remedy was to use the .toFixed() method, forcing the UI to drop the decimal.

When I get more time I'll revisit the problem. Something isn't working correctly and that never works well in the wild.

Thanks!
--Joe.
joe26
 
Posts: 172
Joined: Wed Jun 19, 2013 10:30 pm


Return to SQL Databases

Who is online

Users browsing this forum: No registered users and 5 guests

cron