On this page
XML tables deliver reference data, prices, stock, routes and other accounting-system data to the device. Place them directly in outbox; the table name in the file must match the name in exchange.xml.
For example, for <db name="ref_products"/>, the accounting system creates outbox/ref_products.xml containing the ref_products table.
Table structure
A table XML file has a <table> root element, a <schema> section with fields and a <data> section with records.
<?xml version="1.0" encoding="UTF-8"?>
<table name="ref_products">
<schema>
<field name="code" type="TEXT KEY"/>
<field name="name" type="TEXT"/>
<field name="parent" type="TEXT KEY"/>
<field name="group" type="INTEGER"/>
<field name="packaging" type="REAL"/>
<field name="price_Retail" type="REAL"/>
</schema>
<data>
<record>
<f>P-001</f>
<f>Product</f>
<f>0</f>
<f>0</f>
<f>1</f>
<f>42.5</f>
</record>
</data>
</table>
Each <field> in <schema> defines one field. The number and order of <f> values in each <record> must match the number and order of fields in <schema>.
In this example, the product has no parent group (parent is 0), is not itself a group (group is 0), and has one unit per package (packaging is 1).
Field types
The available data types are INTEGER, INT64, REAL, TEXT, BLOB and DATE. The KEY marker is used to index a field, for example TEXT KEY. It does not require the field values to be unique.
The XML file's encoding must match the encoding value in the XML declaration. For example, if it specifies encoding="utf-8", the file must be saved in UTF-8.
The accounting system must publish only fully written files. Create the file in outbox with a temporary name that is not used by the exchange profiles, such as ref_products.xml.tmp. After writing is complete, close the file and atomically rename it to ref_products.xml in the same directory.
Using a table in a profile
A table is transferred only when its name is included in a <get> profile in exchange.xml:
<get>
<dbs>
<db name="ref_products"/>
</dbs>
</get>
After changing an XML table, run the corresponding exchange profile on the device. There is no need to create or copy service files manually.
