1
0
-1

I am trying to set up number (currency etc) formats in my DSP. I can set text-align to right, but setting a fixed number of decimals, and/or commas for the thousands appears to be beyond the scope of CSS and requires javascript to handle. 

Has anyone got a solution they are willing to share as to how to display numbers in a DSP to a nice format? 

    CommentAdd your comment...

    2 answers

    1.  
      2
      1
      0

      I believe you should be able to handle this via the DIS($NLS(CURRENCY)) or DIS($NLS(NUMERIC)) -

      check the CHM file under "Display Formats for Numeric and Float Data"...

      Regards,

      Knut

      1. Iain Sharp

        Hi Knut, 

        DSPs don't appear to pay any attention to either the DIS syntax or the format trigger. I can do everything I want in the client server side, but not in the web page. 


        Thanks

        Iain

      2. Iain Sharp

        Okay, further updates, since 80% of these numbers are display only, if I change the widget type from editbox to Statictext_Updateable, the system starts to pay attention to the DIS() formats. 

        However, using the $NLS(CURRENCY) puts an unknown character in where there should be a pound sign. 

        Since it is now using the format trigger, I can 'roll my own' formatting to put a pound sign in, and have. 

        I am still left with the 20% of the fields which are editboxes, which I cannot format. I can live with this for the current web-page, but I can see this getting nasty when I want to do something more complex. 

        Regards,

        Iain

      CommentAdd your comment...
    2.  
      1
      0
      -1

      Hi Iain, 

      Here is an example on how to format number on an input using jquery and regular expressions: https://jsfiddle.net/j0rxrun8/1/

      Hope it helps.

      1. Iain Sharp

        Hi Alejandro, 

        Looking at that one, it appears to work on keyup, which means it's for formatting on input, I'm looking to format several fields in many occurrences on display (page load), as well as when they are changed as a result of calculations (possibly also page load? Not sure which events fire when. 

        I was hoping this was a problem that had previously been solved within the community and we could share some known code to display numbers 'correctly' in a web-page. 

        Regards, 

        Iain

      CommentAdd your comment...