ERP 2.50:Developers Guide/Format xml
Contents |
Overview
Format.xml is a configuration file per Openbravo installation that allows you configure the format output for numeric values. It's used by the different numeric references in Application Dictionary, but also can be used in manual code. By default Openbravo ships a Format.xml.template that can be copied as it is without any modification.
Format.xml example
<?xml version="1.0" encoding="UTF-8" ?> <!-- license --> <Formats> <!-- other formats --> <Number name="euroEdition" decimal="." grouping="," formatOutput="#0.00" formatInternal="#0.00" /> <!-- other formats --> </Formats>
Attributes
- name: Name of the format, used to identify it
- decimal: Symbol (character) to be used as decimal separator
- grouping: Symbol (character) to be used as grouping separator (used in thousands)
- formatOutput: Format mask used to mask and print numeric inputs. It must be DecimalFormat output format type: See DecimalFormat class.
- formatInternal: Used internally by XmlEngine
Application dictionary - format name mapping
AD Reference | Output format |
Decimal, Amount | euroEdition |
Quantity | qtyEdition |
Price | priceEdition |
Integer | integerEdition |
Number | generalQtyEdition |
Others numeric | generalQtyEdition |
Important Notes
- You can define a decimal and grouping separator per format type, but the qtyEdition format is the one that defines them. Makes no sense to define different decimal and grouping per format type.
- Rounding numeric values is also affected by the mask of the input. If you want more precision, change the output format attribute.
- Further details on formatting with XmlEngine can be found in the XmlEngine concepts page
- If you don't already have a Format.xml in the WEB-INF directory of your live Openbravo installation and want to experiment with various settings then copy $openbravo_source/config/Format.xml.template to $live_openbravo_installation/WEB-INF/Format.xml, edit it and restart Tomcat. Ultimately, copy $openbravo_source/config/Format.xml.template as Format.xml and "ant compile -Dtab=xx -Dtr=no" because this way the changes will be permament and won't be lost upon the next rebuild.
Languages: |
ERP 2.50:Developers Guide/Openbravo.properties | ERP 2.50:Developers Guide/Code Snippets