Format decimal Places based on variable

2 posts, 0 answers
  1. Frank
    Frank avatar
    85 posts
    Member since:
    Mar 2012

    Posted 11 Jul Link to this post

    I have a text box on a report that I would like to be able to format to a specific number of decimal places based on a variable.  Say if I pass a the value 3 it will be 3 decimal places or if I pass it a 5 it would be 5 decimals places.  Is something like Format("{0:N?}"  where the ? would be a variable, of is it only possible through a series if iif statements? 
  2. Stef
    Stef avatar
    2920 posts

    Posted 12 Jul Link to this post

    Hi Frank,

    Please test using the built-in Format text function in an expression like:
    =Format('{0:N'+ Parameters.Parameter1.Value+'}',1233311.001234567)
    where Parameter1 is an integer value in the example.

    The idea is to build a dynamic format string.

    I hope this information is helpful.

    Telerik by Progress
    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 R3 2016 release webinar banner
Back to Top