Page 1 of 1

Set a default format for a database table column

PostPosted: Tue Oct 24, 2017 1:55 am
by joe26
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

Re: Set a default format for a database table column

PostPosted: Tue Oct 24, 2017 7:19 am
by ROCLASI
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.

Re: Set a default format for a database table column

PostPosted: Tue Oct 24, 2017 8:45 am
by joe26
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.