PDF version of this page

Defining Fields and Rules for XML Input

XML files are readily converted into FormTrap XML format. XML files already have all fields defined, already have the concepts of master and detail and have their contents for Dates and Numeric in useful format. Conversion is quick and the process is outlined below.

This screen shows the XML Template file (top left) with Name and Value of the selected field (top right). Record:Field list (bottom left shows master, then in record definition order, field definition order within Record) and Path (to the XML field) and finally Rule Path for the rule that identifies this document.

If (and only if) the template XML file contains multiple documents, please specify a single rule that identifies the document being defined. Rules are exact match only, with choices for Add and Delete only. Chose a field that is unique for the document type and add a rule for it. In the tutorial, the presence of "OrderLine" identifies this as an "Order". "Order" is the top level name associated with "OrderLine".

Select a field from the XML Template that uniquely identifies this as the required document type, and press (Add Rule). The rule appears in Rule Path (bottom right) and at the top of the Record:Field list with Path as top level item for the document (/Order in the example).

To remove a Rule, highlight it in Rule Path and press (Delete Rule).

To add master fields, select the XML field name and press New Field . This opens the Field dialogue box with the suggestion of the XML name. Key your name, then look at content. If content is numeric or date please select Parser type and Pattern for Dates.

Parser type Date is normally yyyy-MM-dd. These date conventions are available for Pattern:

d one nor two digit day
dd two digit day with leading zero where required
ddd 3-character abbreviation of Day in Locale convention (eg FRI)
dddd full day (Friday)
M one or two digit month
MM two digit nonth with leading zero where required
MMM 3-character abbreviation of Month in Locale convention (eg OCT)
MMMM full month (October)
yy last two digits of year
yyyy four-digit year

Fields appear in the order added in the Records:Fields list, and alphabetically in the Documents, Data, master, Fields list.

Occasionally selecting a field in the XML view may show more than one entry in the Name Value list, as shown below. The "Content" line is always there one line only. Additional "attributes" or optional fields may show, such as CurrencyId in the example.

To define an attribute as a field, highlight it and press New Field .

Attributes are identified by the additional component /@name in XPath (/@currencyId).

Top

Defining Detail Records

To define a Detail record, highlight that record in the XML file and press New Record .

Once you have the record defined, you can define fields in exactly the same way as for master fields.

Top

Defining Detail Record Fields in Master

Occasionally, you may require detail record fields in the Master - common where Delivery Details are present in Detail Lines, are all identical and are require printing on the Report Header. The instructions that follow are exact, with loose explanations - more knowledge of XML is required to fully understand what the actions stand for.

This is the record structure, where delivery details from the first OrderLine are required in master.

Select the field in OrderLine and press New Field .

Supply Name and change Record to master (in place of the assumed detail line record name).

Prefix Xpath with xxx:XMLNameOfDetail/ where xxx is copied from the supplied first three letters. The highlight shows this where xxx is cat. This is case sensitive. This correctly locates the XML field as being within the detail line rather than elsewhere in the structure.

Suffix Xpath with [1], this takes the first detail line data.

Top