Decimal Places
Last Post 03-21-2012 12:23 PM by Cube Dweller. 4 Replies.
AddThis - Bookmarking and Sharing Button
Author Messages
Cube DwellerUser is Offline
wading in the water
wading in the water
Posts:17
Avatar

--
03-20-2012 05:20 AM
    Hi all,

    Is there a way to round or cut off the numbers at 2 decimal places?

    $5.25 instead of $5.2543
    -0.78 instead of -0.7801

    I'm placing this in a tight area and need to save space, and want predictable widths.

    Thanks, CD
    Ryan BakerinkUser is Offline
    river guide
    river guide
    Posts:1900
    Avatar

    --
    03-20-2012 06:14 AM
    Hello,

    Are you pulling in these values from a data base or are you calculating with JavaScript on the fly on the page?

    If it's coming from the data base and you have the ability to format using SQL I would consider using this trick:

    Cast(Cast(Round(cast(ColumnName AS float(10)),2) as Decimal(5,2)) as nvarchar(50)) As AliasName

    This is the best technique I've come across in TSQL, I'm sure there are many predefined functions out on Google that you can use.

    Or if you don't have access to format the value, then you can modify the column type in the data base to accept two decimals.

    Let me know your thoughts or questions.

    Thanks,

    Ryan
    Cube DwellerUser is Offline
    wading in the water
    wading in the water
    Posts:17
    Avatar

    --
    03-20-2012 11:25 AM
    Hi Ryan,

    This is for the Stock Quotes module; I’d like to format some of the numeric tokens in the temple. Such as… $(LastTradePrice) and $(PriceChange)

    I want to force them to 2 decimals for a consistent look. Sometimes the source (Yahoo?) sends 3 or 4 places making the display look jumbled/messy.

    Thanks CD
    Chad NashUser is Offline
    Posts:5260
    Avatar

    --
    03-21-2012 09:47 AM
    Hi CD, what a great forum profile pic

    Unfortunately this is not a feature that the module offers right now... I have added this to the list to review for future enhancements however the module would require modifying the source code to make these changes so you might consider going this route if you own the license with source code and/or having us handle the requirements via Premium Support and Implementations assistance... You can find more details and/or pick up hours at http://www.datasprings.com/PremiumSupport.

    Thanks!

    -Chad
    Cube DwellerUser is Offline
    wading in the water
    wading in the water
    Posts:17
    Avatar

    --
    03-21-2012 12:23 PM
    Whatever the 'decimal places'; this is a great little module and really adds value to our site. (i.e. It makes me look good)

    Thanks for the consistently great support!


    ---
  • film izle
  • 720 izle
  • film
  • sinema izle
  • film makinesi
  • T�rk�e dublaj film
  • film izle
  • film izle
  • baglan film izle
  • sinema izle
  • 1080 film izle
  • film mercegi