XML Database

Provides a NoSQL database environment for varying numbers of big entities. Because of Emakin being quite connected with XML data type, as all contents created by users are being kept primarily in XML form, using XML database is straightforwardly practical. The data stored in XML database is held as a big whole XML chunk containing various smaller XML nodes in a tree like structure. This data can be retrieved from within server-side scripts of processes to populate forms using XmlNode.Load$XmlRepository.Query and $XmlRepository.QueryXml methods and on the forms with XML Database Query data source.

There are two types of XML databases used when storing XML data in Emakin: those are process databases and a domain database.

Domain Database

For every domain hosted on Emakin, a separate XML database is created. This database is reserved only for special cases, and Emakin does not store any data by default. You can save data into your domain database by using XmlNode.Save and $XmlRepository.Save methods.

General usage examples are as follows:

  • Storing settings for processes
  • Saving important process parameters
  • Keeping pre-formatted statistics to later display in dashboard reports
  • Storing scripts that can be loaded and executed later in processes

Since this database is reserved for custom usage, there is no default root node so you have to define a unique and describing root name when saving your data.

See below for an XML example of a custom settings data. 

Settings Data
<LRDictionary>
  <Definitions>
    <HRGroup Caption="Human Resources Specialist">44ed5931-eef1-48ed-8d11-1cdef1d272dd</HRGroup>
    <HRManager Caption="Human Resources Manager">126945af-5ff5-49ef-8f55-0b702ad06530</HRManager>
    <LeaveTypes>
      <LeaveType>
        <Name>Annual</Name>
        <Code>A</Code>
        <SubLeaveTypes/>
        <Name_tr>Yıllık</Name_tr>
        <IncludeOnCalculation>True</IncludeOnCalculation>
        <HasSubTypes>false</HasSubTypes>
      </LeaveType>
      <LeaveType>
        <Name>Excuse</Name>
        <Code>E</Code>
        <SubLeaveTypes>
          <SubLeaveType>
            <Id>ac9572db-7045-4a37-a170-1781d56483d3</Id>
            <Name>Sickness</Name>
            <Name_tr>Hastalık</Name_tr>
          </SubLeaveType>
          <SubLeaveType>
            <Id>23cc603f-d037-4acc-90c9-8dc26aefb05a</Id>
            <Name>Death</Name>
            <Name_tr>Vefat</Name_tr>
          </SubLeaveType>
          <SubLeaveType>
            <Id>bc1f4fbc-1b81-4e92-9daa-b91ca39af77a</Id>
            <Name>Other</Name>
            <Name_tr>Diğer</Name_tr>
          </SubLeaveType>
        </SubLeaveTypes>
        <Name_tr>Mazeret</Name_tr>
        <IncludeOnCalculation/>
        <HasSubTypes>true</HasSubTypes>
      </LeaveType>
    </LeaveTypes>
    <Calculation/>
    <Manager2Approval>True</Manager2Approval>
    <SecondManagerApprovalExcluded>
      <Identity Caption="Irmak Bardakçı" Type="" Domain="">f2767cb6-4cb5-45a8-ad0f-a01af17c2fb6</Identity>
      <Identity Caption="Bülent Yüksel" Type="" Domain="">b8e60233-7fce-4d8d-a597-acd4fd90ce05</Identity>
      <Identity Caption="Gökhan Berker" Type="" Domain="">c0d262ef-afcb-4ec5-8cba-b402ef13727b</Identity>
      <Identity Caption="Esin Kent" Type="" Domain="">38e708df-1b8f-44e2-a13f-c35fe94e5355</Identity>
      <Identity Caption="Nesrin Cevdet" Type="" Domain="">63612ed1-0bd5-49a0-a490-c37cef4e07fd</Identity>
    </SecondManagerApprovalExcluded>
    <DayCountForWeek>5</DayCountForWeek>
  </Definitions>
</LRDictionary>

In this example, settings for the Leave Request process get stored in domain database and their data is enclosed between <LRDictionary> tags as an arbitrary choice. It includes HR authorities' information, leave type definitions and their localization data, and a list of people for some exceptions depending on the design of the process. A settings screen designed in this process loads this XML data and lets users to modify it depending on their needs, which makes this process quite flexible.

Process Database

Every time a process is created in Emakin, a separate XML database is allocated for that process automatically. All the workflows running on Emakin keep their data as XML forms and whenever a workflow gets triggered from a process, its form content and an XML metadata of this workflow gets stored into the corresponding process database alongside under the root node. Any changes made on the flow automatically updates this data, for example taking an action on a task or completing a flow.

The data stored here is almost identical to the data stored in the relational database except for it being in an XML form. The key difference here is that XML data of a workflow is more compact and easier to obtain and organize to create desired reports with it. Besides retrieving that data from SQL, data tables are managed by Emakin's built-in functions in a restricted aspect. For this reason, using the process data stored in XML databases is more practical when generating report views depending on process data.

Instance Data

The XML metadata stored in the process database is enclosed within <Instance> tags and contains various information about the goings-on of a workflow. Instance node represents the workflow itself and contains a list of every work item owned. Whenever a work item belonging to a flow is completed, its XML metadata gets stored into its corresponding work items list.

Just as a work item is completed, a unique background job called "Instance Xml Database Replication" gets created for its instance and executed to write its metadata into the database. You can use Background Jobs Manager to monitor the status of these jobs.

See below for an XML example of instance data:

Instance Data
<Instance>
  <Id>2fbeff56-2574-4950-91b2-11eec2c63586</Id>
  <Number>217</Number>
  <TestMode>True</TestMode>
  <Culture>en-US</Culture>
  <State>Completed</State>
  <Start>2019-03-14T11:02:09.1982068+03:00</Start>
  <End>2019-03-14T11:05:01.5890176+03:00</End>
  <WorkItems>
    <WorkItem>
      <Id>cd4d51a2-0ca0-4b2d-aa5c-a9d8de07243b</Id>
      <Name>Expense Form</Name>
      <Caption>Expense Form</Caption>
      <State>Completed</State>
      <Start>2019-03-14T11:02:09.1982068+03:00</Start>
      <End>2019-03-14T11:04:22.8982862+03:00</End>
      <Duration>2.2283346566666666</Duration>
      <SelectedActionId>05671ad9-65d9-41f6-aa84-20ce2a984676</SelectedActionId>
      <SelectedAction>Submit</SelectedAction>
      <IsDeadlined>False</IsDeadlined>
      <DeadlineDate/>
      <Previous/>
      <CompletedBy Caption="Bülent Yüksel">b8e60233-7fce-4d8d-a597-acd4fd90ce05</CompletedBy>
      <DataId>f2e38788-9dbc-4e80-8c93-0b9410c07642</DataId>
      <DataRoot>ExpenseForm</DataRoot>
    </WorkItem>
    <WorkItem>
      <Id>c026a945-b309-42ee-a335-eade87c79e23</Id>
      <Name>Expense Payment</Name>
      <Caption>Expense Payment</Caption>
      <State>Completed</State>
      <Start>2019-03-14T11:04:44.2056377+03:00</Start>
      <End>2019-03-14T11:04:53.2101814+03:00</End>
      <Duration>0.15007572833333332</Duration>
      <SelectedActionId>4e7a6cb3-b529-492f-b796-6764c86f9956</SelectedActionId>
      <SelectedAction>Completed</SelectedAction>
      <IsDeadlined>False</IsDeadlined>
      <DeadlineDate/>
      <Previous>8c97b0af-4545-49ed-9539-f38ca3284953</Previous>
      <CompletedBy Caption="Bülent Yüksel">b8e60233-7fce-4d8d-a597-acd4fd90ce05</CompletedBy>
      <DataId>f2e38788-9dbc-4e80-8c93-0b9410c07642</DataId>
      <DataRoot>ExpenseForm</DataRoot>
    </WorkItem>
    <WorkItem>
      <Id>8c97b0af-4545-49ed-9539-f38ca3284953</Id>
      <Name>Manager Approval</Name>
      <Caption>Manager Approval</Caption>
      <State>Completed</State>
      <Start>2019-03-14T11:04:23.0425214+03:00</Start>
      <End>2019-03-14T11:04:44.2056377+03:00</End>
      <Duration>0.352718605</Duration>
      <SelectedActionId>8ee3e1f2-6d82-4bf2-be00-e6263d8d61c4</SelectedActionId>
      <SelectedAction>Approve</SelectedAction>
      <IsDeadlined>False</IsDeadlined>
      <DeadlineDate>2019-03-21T09:00:00+03:00</DeadlineDate>
      <Previous>cd4d51a2-0ca0-4b2d-aa5c-a9d8de07243b</Previous>
      <CompletedBy Caption="Bülent Yüksel">b8e60233-7fce-4d8d-a597-acd4fd90ce05</CompletedBy>
      <DataId>f2e38788-9dbc-4e80-8c93-0b9410c07642</DataId>
      <DataRoot>ExpenseForm</DataRoot>
    </WorkItem>
  </WorkItems>
</Instance>

Form Data

Similar to the instance metadata, form content generated by the process also gets stored into process database and is enclosed within <form> tags. Every time a work item is completed, its existing XML form data gets updated to reflect the latest changes made on the form.

Just as a work item is completed, a unique background job called "Form Data Xml Database Replication" gets created for its form and executed to write the content into the database. You can use Background Jobs Manager to monitor the status of these jobs.

See below for an XML example of the form data:

Form Data
<form Id="f2e38788-9dbc-4e80-8c93-0b9410c07642">
  <ExpenseForm>
    <PersonnelInformation>
      <Owner Caption="Bülent Yüksel" Type="User" Domain="cadf027b-8cc3-41e1-b0e2-ed856a0579fa">b8e60233-7fce-4d8d-a597-acd4fd90ce05</Owner>
      <RegistryNumber>4444</RegistryNumber>
      <Department Caption="Research and Development">c647464d-3745-4373-8309-0cfa0a34ae70</Department>
      <Location Caption=""/>
    </PersonnelInformation>
    <ExpenseInformation>
      <Date>2019-03-14T11:02:09.2821462+03:00</Date>
    </ExpenseInformation>
    <ExpenseList>
      <Expense>
        <Id>2ccb89d7-b32a-478a-b481-ae393caf3100</Id>
        <Date>2019-03-06T00:00:00+03:00</Date>
        <ExpenseTypeGroup Caption="Transport">16</ExpenseTypeGroup>
        <ExpenseType Caption="Highway">1601</ExpenseType>
        <CostArea/>
        <DocumentDate/>
        <Reason>Taxi fare to customer</Reason>
        <DocumentNumber/>
        <DocumentTitle/>
        <DocumentTaxNumber/>
        <Amount>18.00</Amount>
        <Unit Caption="US Dollar">USD</Unit>
        <CrossRate>1.00</CrossRate>
        <ConvertedAmount>18</ConvertedAmount>
        <VAT Caption="8">8</VAT>
      </Expense>
    </ExpenseList>
  </ExpenseForm>
</form>




Copyright © 2010 - 2023 Emakin. All rights reserved.