Changing field type to decimal 8,2
4 posts by 3 authors in: Forums > CMS Builder
Last Post: November 26, 2008 (RSS)
By zaba - November 26, 2008
Hi,
I want to have a specific field type, in this case decimal, as I am performing calculations on that field. I can manually change it by doing it directly on the mysql database (using CocoaMySQL - a MySql GUI for Mac OSX). I would like to have this as an option in cms builder. If I make any changes in cms builder it reverts back to the default field type. Do I have to alter the ini file for that particular category?
I want to have a specific field type, in this case decimal, as I am performing calculations on that field. I can manually change it by doing it directly on the mysql database (using CocoaMySQL - a MySql GUI for Mac OSX). I would like to have this as an option in cms builder. If I make any changes in cms builder it reverts back to the default field type. Do I have to alter the ini file for that particular category?
Re: [zaba] Changing field type to decimal 8,2
By Kenny - November 26, 2008
Hi zaba -
I'm not quite sure what your are trying to accomplish but maybe this will help:
<?php echo number_format($record['number'] ,2) ?>
The ",2" tells it to give two decimal places (you can change this to 8)
The "number_format" tells it to treat it like a number to include comma separators.
If you plan on sorting by numbers, then use this:
'orderBy' => 'price+0 DESC',
Let us know if that doesn't help and we can take it from there.
Kenny
I'm not quite sure what your are trying to accomplish but maybe this will help:
<?php echo number_format($record['number'] ,2) ?>
The ",2" tells it to give two decimal places (you can change this to 8)
The "number_format" tells it to treat it like a number to include comma separators.
If you plan on sorting by numbers, then use this:
'orderBy' => 'price+0 DESC',
Let us know if that doesn't help and we can take it from there.
Kenny
Re: [zaba] Changing field type to decimal 8,2
By Dave - November 26, 2008
Hi zaba,
If you want to actually override the mysql column type you can specify that in CMS Builder's schema file directly in /data/schema/yourSection.ini.php like this:
customColumnType = "int(10) unsigned NOT NULL"
You can have a look at /data/schema/uploads.ini.php for an example.
Hope that helps!
If you want to actually override the mysql column type you can specify that in CMS Builder's schema file directly in /data/schema/yourSection.ini.php like this:
customColumnType = "int(10) unsigned NOT NULL"
You can have a look at /data/schema/uploads.ini.php for an example.
Hope that helps!
Dave Edis - Senior Developer
interactivetools.com
interactivetools.com
Re: [Dave] Changing field type to decimal 8,2
By zaba - November 26, 2008
Thanks Dave,
I'll give it a whirl and see what happens.
I'll give it a whirl and see what happens.