Format function remove trailing zeros in expression

3 posts, 0 answers
  1. Dustin
    Dustin avatar
    2 posts
    Member since:
    Dec 2014

    Posted 08 Feb Link to this post

    I am having an extremely difficult time doing a simple task. I need to create a text box that contains both text and a decimal from my database. I want to add formatting to the decimal to remove all trailing zeros (not round, I want the full number displayed just not trailing zeros). Below is my current textbox value and the result;
    ='Acreage:  '+ Fields.AssignmentAcres
    Acreage:  640.000000000000000000
    I've tried every iteration I can think of with the format function to no avail. Below is what I assume the textbox should look like but I keep receiving errors.
    ='Acreage:  '+Format(Fields.AssignmentAcres, '####################.######################')
    I've tried with single quotes, double quotes, no quotes, I even tried the formatting '0000.0000....'. No matter what I keep receiving errors. Please keep in mind that I am not a developer, I do not know coding very well. I've seen several answers googling this that requires quite a bit of code and I have no idea where to even put that code. I am using the "Edit Expression" dialog box to enter my field values. Thanks
  2. Nasko
    Admin
    Nasko avatar
    909 posts

    Posted 09 Feb Link to this post

    Hello Dustin,

    You need to use a different syntax for the Format(format, args) text function:

    = 'Acreage: ' + Format('{0:####################.######################}', Fields.value)

    The first argument is the format. The second in this case is the value. You can also find example usages in the Edit Expression window.
    Additional information on the topic is present in the Custom Numeric Format Strings MSDN page.

    Regards,
    Nasko
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. DevCraft banner
  4. Dustin
    Dustin avatar
    2 posts
    Member since:
    Dec 2014

    Posted 09 Feb in reply to Nasko Link to this post

    That is perfect, thanks so much
Back to Top