Skip to main content

Amount Script Formatter 2, 3 and 4 Decimals


QAID # 17761 Published

Question / Problem:

Amount Script Formatter 2, 3 and 4 Decimals

Answer / Solution:

  • €12.34
  • €12.345
  • €12.3456

Use Case

  • The formatting of the cells of an inherited table cannot be altered, due to the KTM inheritance design.
    This article describes a work around for the problem - a work around which is actually a best practice.
  • Vendors sometimes print a line item unit price with more than just two decimal places, for example, €12.345 or €12.3456.
    The unit price is often printed in this way when the unit is very small, for example, screws.


In this case, the line item unit price needs to be formatted differently than the standard amount, which has 2 decimal places:

Screen Shot 2018-09-12 at 7.31.35 AM.png

Example Results

Screen Shot 2018-09-12 at 7.32.03 AM.png


  1. Create amount formatting methods for 2, 3 and 4 decimal places:
  • Amounts2Decimals
    Screen Shot 2018-09-12 at 7.33.07 AM.png
  • Amounts3Decimal
    Screen Shot 2018-09-12 at 7.34.00 AM.png
  • Amounts4Decimals
    Screen Shot 2018-09-12 at 7.35.41 AM.png
  1. Create a multi-field Script Formatter:
    1. Name it AmountsTable.
    2. Set the field data type to Double/Amount:
      Screen Shot 2018-09-12 at 7.51.21 AM.png
    3. Add the following script to the Project Script: AmountsTable_FormatDoubleField.
  2. Create a validation method for the line item:
    Screen Shot 2018-09-12 at 7.52.08 AM.png
    1. Add the following script to the Project Script:
      Quantity / Unit of Quantity x Unit Price = Line Item Total Price
    2. Create a table model
      Screen Shot 2018-09-12 at 7.53.27 AM.png
    3. Create a format locator for amounts and a table locator
      Screen Shot 2018-09-12 at 7.53.43 AM.png
    4. Create a field of type table
      Screen Shot 2018-09-12 at 7.53.59 AM.png

Applies to:

Product Version Category
AXPRO 5.5 Project Builder