1 Reply Latest reply on Apr 19, 2016 3:49 PM by Brent Mathison

    Setting dynamic decimal values for a table

    Romil Shah



      Currently I have set 2 decimal points for a field in worksheet.


      My requirement is - I want to see decimal points only if a value has decimal points, but if it doesn't then decimals should not show up at all.


      For e.g. If a value is 0.05 then it should be displayed as "0.05", but if it is 100 then it should be displayed as "100" and not "100.00"


      Hence I want decimal values to be 2 at times when it has a decimal value, but it should be 0 when it doesnt.


      Is there any way I can do that? Any way I can write a code in Format option to handle this




        • 1. Re: Setting dynamic decimal values for a table
          Brent Mathison

          Hi Romil. Are you just displaying the value as a label? If so, you could use a calculated field to convert the value to a string and parse the string. The formula would be similar to this:


          IF FIND('.',STR([value]))>0 AND RIGHT(STR([value]),1) <> '0'

              THEN STR([value])

          ELSEIF FIND('.',STR([value]))>0 THEN LEFT(STR([value]),FIND('.',STR([value]))-1)

          ELSE STR([value])