9 Replies Latest reply on Oct 20, 2014 11:23 AM by try67

    Help with multiline sum and formatting ","

    lapneto

       

      Hey guys, I need help with an issue I am struggling to solve...

      I have a multiline field in which I paste information from an excel spreadsheet. This information is in a 1.234,56 format.

      I was able to have the numbers pasted across the field in another field, by removing the ",": something like this:

       

      var withcoma = this.getField("Input_1").value; //this is my multiline field used to paste data from excel

      nocoma = withcoma.replace(/\,/g,".");

      var values = nocoma.split("\r");

      var total = 0;

      for (var i in values) total+=Number(values[i]);

      this.getField("Total").value = total;


      The point is that I need to be able to change the numbers that I have in 1.234,56 format to 1,234.56 format if I choose to use a different currency than my original and also have the numbers in the "Total" field properly updated.

       

      Could someone point me in the right direction?

       

      Many thanks!!!