I have a value field in a custom module and I want it to display 2 decimal place in a subpanel
ie 64 display as 64.00
How can I do this?
I have a value field in a custom module and I want it to display 2 decimal place in a subpanel
ie 64 display as 64.00
How can I do this?
Hi, mikesolomon
You can override into your module Class the function get_list_view_array, located into data/SugarBean.php
You can use the function format_number into modules/Currencies/Currency.php for formating the value and insert into $return_array.
Cheers
--
André Lopes
Lâmpada Global Services
Rua Bela Cintra, 299 conjunto. 51
São Paulo, SP 01415-000
tel1. 55 11 3237-3110
cel. 55 11 7636-5859
e-mail: info@lampadacrm.com.br
ThanksOriginally Posted by andopes
Are you saying take get_list_view_array from data/SugarBean.php and put it into my module?
must admit I'm a bit confused on what I need to do
Hi, mikesolomon
You have to define this same function under your module, this one will call the parent function (SugarBean function) and after this modify the $return_array according to your needs.
Cheers
--
André Lopes
Lâmpada Global Services
Rua Bela Cintra, 299 conjunto. 51
São Paulo, SP 01415-000
tel1. 55 11 3237-3110
cel. 55 11 7636-5859
e-mail: info@lampadacrm.com.br
Perfect - that works perfectly
On the same note how can I align a value field right in the subpanel - at the moment it is aligned left
Hi, mikesolomon
I believe it is possible, but not right easy to do.
Take a look at the script include/SubPanel/SubPanel.php
The listview view use the $params array for deciding how to render a listview row, perhaps the subpanel use the same strategy.
Cheers
--
André Lopes
Lâmpada Global Services
Rua Bela Cintra, 299 conjunto. 51
São Paulo, SP 01415-000
tel1. 55 11 3237-3110
cel. 55 11 7636-5859
e-mail: info@lampadacrm.com.br
Have you tried the simple route of simply setting the "Precision" value on the custom field defintion? In Studio when you create a custom field of type Decimal, you can set the Precision value which determines the number of decimal places to display for that field.
Sugar Developer Zone - developer resources | Sugar University - user and admin training
Sugar Docs - user and admin documentation | Sugar Bug Tracker - Enter or view bugs
SugarForge- open source modules, themes, lang packs | SugarExchange - commercial extensions
Clint Oram
Chief Technology Officer and Co-founder
SugarCRM
I set the precision to 2 but it didnt seem to work - when I look at the field in module builder it has a precision of 2 but in mysql it shows as - FLOAT(12,0)Originally Posted by clint
Looks like the module builder is not creating the field properly
Anyway it is working now
Just got to work out how to align values right in the subpanel
This appears to be a bugOriginally Posted by clint
The Vardefs entry is
'value' =>
array (
'required' => false,
'name' => 'value',
'vname' => 'LBL_VALUE',
'type' => 'float',
'massupdate' => 0,
'comments' => '',
'help' => '',
'duplicate_merge' => 'disabled',
'duplicate_merge_dom_value' => 0,
'audited' => 0,
'reportable' => 0,
'len' => '18',
'precision' => '2',
),
but that creates a field in mysql
`value` FLOAT(12,0) DEFAULT NULL,
so len & precision are being ignored![]()
Hi, mikesolomon
The len of the field seems to be so big. I'm not sure it is the cause of trouble, but....
Try to redefine the fields def to len like 12 and precision 2..
Repair database and check the change into database.
Cheers
--
André Lopes
Lâmpada Global Services
SugarCRM Silver Partner
USA: +1 908 998-2278
BR: +55 11 3237-3110
www.lampadaglobal.com
email: info@lampadaglobal.com
Lampada Global Services delivers enterprise software and offshore programming services to customers around the world.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks