Skip to main content
marks84376706
Participant
November 16, 2021
Question

lscurrencyformat without rounding

  • November 16, 2021
  • 4 replies
  • 215 views

Hi,

We need to support currency values that are configurable to allow up to 6 decimal places regardless of the currency.  Is there any way to disable or modify the rounding that is applied by lscurrencyformat?

 

thanks,

Mark

    This topic is closed to new replies. Start a new post to keep the conversation going.

    4 replies

    BKBK
    Community Expert
    Community Expert
    November 16, 2021

    I don't think IsCurrencyFormat is possible without rounding. From my understanding the function comes out of the box together with rounding to 2 or 3 decimal places. I would presume that that is because the smallest unit of the majority of currencies is 1/100th or 1/1000th. For example, 100 cents to the dollar and 100 eurocents to the euro.

     

    What you could do is: create your own function. Start by creating a database table called currency. It consists of 4 columns (id, locale, symbol, numberOfDecimals).. The function could then work as follows:

     

     

    string function formatCurrency(required numeric amount, required string locale) {
        // Using arguments.locale, get the currency symbol from the database,
        // together with the number of decimals in which to round off.
        // Return the amount in the desired currency format.
    }

     

     

     

    BKBK
    Community Expert
    Community Expert
    November 23, 2021

    So, does that answer your question?

    marks84376706
    Participant
    November 23, 2021

    Thanks.  I guess I'd also have to handle the thousands and decimal separators and whether the currency symbol is positioned before or after the value, maybe?