Graphics

 View Only
  • 1.  Limit the amount of Decimal Places

    Posted 04-08-2015 13:54
    Is there a way to limit text to only display up to two decimal points?


  • 2.  RE: Limit the amount of Decimal Places

    Posted 04-08-2015 15:54
    This will be one of those awful ambiguous responses that doesn't really answer your question, but hopefully gets you or someone else started on it.

    I've used the `ToString` function in the past in OnSetText in order to adjust characters accordingly. I had a discussion about this function on another thread which has some good tips over HERE. Hopefully that can get you started.

    #XPression


  • 3.  RE: Limit the amount of Decimal Places

    Posted 04-08-2015 16:04
    The latest versions of XPression have a FormatFloat block in Visual Logic which you can use to specify the precision of a number. This would probably do what you need.

    #XPression


  • 4.  RE: Limit the amount of Decimal Places

    Posted 04-08-2015 16:22
    Hi Brian,

    FormatFloat sounds like the perfect solution. I'm looking in the Visual Logic Function Blocks and can't find the FormatFloat block. Am I looking in the right spot? I may have a version that doesn't have it (Developer v5.7 3086), and if so, where can I get a newer version?

    Richard

    #XPression


  • 5.  RE: Limit the amount of Decimal Places

    Posted 04-08-2015 20:43
    Thanks everyone for your help,

    I ended up using the following script on the onsettext to only display two decimal points:

    text = Convert.ToDouble("0"³ + text).ToString("0.00"³)

    hooray!

    #XPression