6 Replies Latest reply on Jul 10, 2015 11:35 AM by guptamax2015

    using script to get percentage values and not able to sum upto 100%

    guptamax2015

      Hello All 

       

      I am trying to use a parseFloat() function to convert string to percentage value and then trying to add all of the % values.

       

      but for few scenrios even if the sum is 100%, from the function i get the PctValue either < or > 100.00%

       

      function doing the calculation is as follows -

       

      code -

      iterating_through_all_the_fields {

       

           PctValue += parseFloat(this.getField("Percentage1").valueAsString);

       

      }

       

      sample -

      11.12

      11.11

      11.11

      11.11

      11.11

      11.11

      11.11

      11.11

      11.11

       

      expected sum is 100

       

      but through above mentioned code i get back 99.99

       

      Any help is appreciated in this regard.