Skip to content

Data Model

Use the data model to define the XML structure that stores process data at runtime. Forms, scripts, rules, pools, and screens all read from or write to this structure.

Emakin uses XML to manage process data, which enables flexible schemas and advanced querying with XPath and XQuery.

Data Model Structure

The process's data structure is defined using an XSD schema, which can reference external XSD files. All XML processing adheres to this schema.

Each workflow instance is stored in a single XML file. Upon creation, a form element is automatically added, and workflow pools are appended as needed.

Data Model Design and Modification

The Emakin process designer provides a user-friendly interface for data model design. Underlyingly, the data model is defined in XSD. The form designer automatically creates corresponding data model fields; custom fields can be added via the data model designer.

Example Data Model (XSD)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
    <xs:element name="Data">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="MyField" type="xs:string"/>
                <xs:element name="MyList">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="Row" maxOccurs="unbounded">
                                <xs:complexType>
                                    <xs:sequence>
                                        <xs:element name="MyOtherField" type="xs:string"/>
                                    </xs:sequence>
                                </xs:complexType>
                            </xs:element>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>

This XSD generates XML data like this:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
<Data>
    <MyField>Value</MyField>
    <MyList>
        <Row>
            <MyOtherField>Value</MyOtherField>
        </Row>
        <Row>
            <MyOtherField>Value</MyOtherField>
        </Row>
    </MyList>
</Data>

Data Model Bindings

Workflow pools and screens bind to a root element in the data model, such as Data in the example above. This root element is the context for form elements, scripting ($Xml), and other operations. XPath expressions handle binding to nested elements.

Choosing Pool Data Roots

Set each pool's RootElement explicitly to the name of a root xs:element declared in the XSD. RootElement is required when creating a process flow or process-flow skeleton through the development tools; omitting it or supplying an empty value is invalid.

Choose a meaningful root name that reflects the pool's business purpose. Pools that perform semantically different work should have different roots. For example, a leave-request pool should use LeaveRequest, while an expense-claim pool should use ExpenseClaim, even when both pools belong to the same process definition. Keep each pool's business fields under its corresponding root.

Multiple pools can technically bind to the same root. Use this deliberately when they share the same business data model, rather than to simplify development or combine unrelated data under one root. Sharing an XSD root does not by itself configure data exchange between workflow instances.

Form Element Bindings

A textbox bound to MyField:

1
<TextBox XPath="MyField"/>

Binding to a nested element:

1
<TextBox XPath="MyList/Row[1]/MyOtherField"/>

Namespace Support

Emakin uses an empty namespace by default. To use namespaces, define them in the namespaces section with an empty prefix. This modifies XPath expressions (form bindings, script evaluations) to incorporate the namespace.