Display decimals for amount field on List

Help please!

I have an Amount field on a list page.  The underlying data in the table which produces the list indicates the value goes out two decimal places.  (Ex.  18,947.67)

However, on the list it is displayed as $18,948.

On an entry screen, when I need to display the decimal and the user preference is set to 0, I have used this in the create script of the field.

CRM.UserOption("OldDecimalPlaces") = CRM.UserOption("NSet_DecimalPlaces");
CRM.UserOption("NSet_DecimalPlaces") = 2;

and then this on the last field of the screen..

CRM.UserOption("OldDecimalPlaces") = CRM.UserOption("NSet_DecimalPlaces");
CRM.UserOption("NSet_DecimalPlaces") = 0;

However, this is not working for me for a list.

I updated the user preference to display 2 decimal places in hopes that this would cause the amount to properly display on the list.  However, the value is still displaying without decimals.

The page is being generated by a .net dll.  Therefore, I am not able to go into an asp page and make modifications.

Is there something I can add to the custom content area to get the value to show with two decimal places?  If so, can someone shove me in the right direction.

Any assistance would be greatly appreciated.

THank you!

  • 0

    Hi Michele

    " $18,948." looks like the number has been truncated.  I wonder if the .net page that is generating this, is truncating the value.  

    Who created the .NET page?

  • 0

    With the number of decimal places set to zero, floating point numbers will be rounded to the nearest integer.

    When I need to have more decimal places than the set number I use a text field to store the string equivalent of the number.  The string then needs to be converted into a number if calculations are to be done.  In your case where you don't have access to the dll code I would create a new text field and add a table script to convert the numeric value to a string and save it in the new field. 

    Eg if the numeric field is called 'enty_quantity' and the new text field is called 'enty_quantitystr' then in the tls Insert() and Update() functions add:

    Values("enty_quantitystr") = Values("enty_quantity").toFixed(2); 

    Use the text field in your list screen instead of the numeric.

    You will need to initialise the new field with the string equivalents of the numeric values in SSMS.  From then on the text field will be updated from the numeric field when a record is saved.

  • 0 in reply to Sage CRM

    The .net page was created by another partner that we work with.  I think the .net page is rounding the value which is why when I changed the user preference to show decimal places, it did not change what was displayed. 

    I had reached out to the partner that created the .net page previously for assistance.  However, what was returned didn't help.  The script provided was to add .00 to the end of the value rather than remove the rounding.  The script came with, "you will need to make some changes to this".  However, I have not been able to make it work.  I see a response from Paul C that makes sense to me.  Therefore, I am going to see if I can make that work.

    If that does not work, I will reach back out to the partner.

    If this had not been a .net page, would the script that is normally used on an entry screen page have worked here?

    Your assistance is always greatly appreciated!!

  • 0 in reply to Paul C

    Paul C:  Thank you!  This solution makes sense to me!  I also like it because it will hold after an upgrade.  I am going to give this a go today.  I will let you know if it works out for me.

    Again, thank you!