2 Replies Latest reply on Sep 29, 2015 6:00 AM by CCSDVS21

    Format number as currency within a string of other values

    CCSDVS21

      I used this script to pull text field entries and format as a paragraph. 

       

      // Get the field values, as strings

      var d1 = getField("d1").valueAsString;

      var d9 = getField("d9").valueAsString;

      var totalcommission = getField("totalcommission").valueAsString;

       

       

      // Combine values, separated by a space

       

      event.value = "We agree to pay the participating broker(s), " + d1 + " and " + d9 + ", a commission in the amount of: " + totalcommission + ".";

       

      Everything works great other than the format of the field 'totalcommission'.  The result is currently "we agree to pay the participating broker(s), x and x, a commission in the amount of: 10000.  I need that sentence to end  "the amount of $10,000.00".  The totalcommission field may vary in amount from as little as $50 to $10,000 (always USD).  Any help is appreciated.