title: Format mask for number field items: trailing and 'leading' zero
body: <p>I'm having some trouble with displaying numbers in apex, but only when i fill them in through code. When numbers are fetched through an automated row fetch, they're fine!</p>
  
  <p><strong>Leading Zero</strong></p>
  
  <p>For example, i have a report where a user can click a link, which runs a javascript function. There i get detailed values for that record through an application process. The returned values are in JSON. Several fields are number fields.
  My response looks as follows (fe):</p>
  
  <pre><code>{"AVAILABLE_STOCK": "15818", "WEIGHT": ".001", "VOLUME": ".00009", "BASIC_PRICE": ".06", "COST_PRICE": ".01"}
  </code></pre>
  
  <p>Already the numbers here 'not correct': values less than one do not have a zero before the .
  I kind of hoped that the format mask on the items would catch this. If i specify <code>FM999G990D000</code> for the item weight, i'd expect it to show '0.001' .</p>
  
  <p>But okay, i suppose it only works that way when it comes through session state, and not when you set an item value through $("#").val() ?</p>
  
  <p>Where do i go wrong? Is my only option to change my select in the app process?
  Now:</p>
  
  <pre><code>  SELECT '"AVAILABLE_STOCK": "' || AVAILABLE_STOCK ||'", '||
           '"WEIGHT": "'          || WEIGHT          ||'", '||
           '"VOLUME": "'          || VOLUME          ||'", '||
           '"BASIC_PRICE": "'     || BASIC_PRICE     ||'", '||
  </code></pre>
  
  <p>Do i need to provide my numberfields a to_char with the format mask here (<code>to_char(available_stock, 'FM999G990D000')</code>) ?</p>
  
  <p>Right now i need to put my numbers between quotes ofcourse, or i get invalid json when i parse it.</p>
  
  <p><strong>Trailing Zero</strong></p>
  
  <p>I have an application process on a page on the after header point, right after an automated row fetch. Several fields are calculated here (totals). The variables used are all specified as number(10, 2). All values are correct and rounded to 2 values after the comma. My format masks on the items are also specified as <code>FM999G999G990D00</code>. </p>
  
  <p>However, when one of the calculated values has only one meaningfull value after the comma, the trailing zeros get dropped. Instead of '987.50', it is displayed as '987.5'.
  So, i have a number variable, and assign it like this: <code>:P12_NDB_TOTAL_INCL := v_totI;</code>
  Would i need to convert my numbers here too, with format mask?</p>
  
  <p>What am i doing wrong, or what am i missing?</p>