Sample
import XML files
ATTENTION:
The global variables AUTHOR and TYPIST are used in the examples. To be able to
use the examples, you should set the correct values of these variables.
File Example1.xml
In this
example we create a document with one version and with one attachment and then
we update the «Description» attribute in the form of this document.
<HBXMLIMPORT version="1.0">
<!--
GLOBAL
VARIABLES:
%AUTHOR_ID%
- the ID of the user in order to specify him as the author of the documents
(the values of the field DOCSADM.PEOPLE.USER_ID)
%TYPIST_ID%
- the ID of the user in order to specify him as the operator who typed the
documents (the values of the field DOCSADM.PEOPLE.USER_ID)
NOTE:
This
example is part of the group of connected examples 1, 2, 3.
-->
<!-- Variable containing
the ID of the standard form -->
<VARIABLE name="FORM" type="static">
DEF_PROF
</VARIABLE>
<!-- Creating the
document -->
<DOCUMENT id="doc" action="create" onerror="break">
<!-- Filling out the
fields in the profile of the document -->
<PROFILE form="%FORM%">
<FIELD name="DOCNAME">Document 1</FIELD>
<FIELD name="AUTHOR_ID">%AUTHOR_ID%</FIELD>
<FIELD name="TYPIST_ID">%TYPIST_ID%</FIELD>
<FIELD name="APP_ID">MS WORD</FIELD>
<FIELD name="TYPE_ID">DEFAULT</FIELD>
<SECURITY action="add">
<GROUP group_id="DOCS_USERS">
<ACCESSRIGHTS
view_profile="yes"
?dit_profile="yes"
view_content="yes"
retreive_content="yes"
?dit_content="yes"
copy_content="yes"
delete_content="yes"
control_access="yes"
assign_to_file="yes"
view_only_published="yes"/>
</GROUP>
</SECURITY>
</PROFILE>
<!-- Operations with the
document -->
<ACTIONS>
<!-- Creating a version
based on the external file ..\Docs\Document.doc -->
<CREATE_VERSION copy="no" subversion="no" author="%AUTHOR_ID%" typist="%TYPIST_ID%" comment="Document version 1">
<CONTENT location="external">..\Docs\Document.doc</CONTENT>
</CREATE_VERSION>
<!-- Creating an
attachment based on the external file ..\Docs\Document.xls -->
<CREATE_ATTACHMENT label="XLS" author="%AUTHOR_ID%" typist="%TYPIST_ID%" comment="Document
attachment XLS">
<CONTENT location="external">..\Docs\Document.xls</CONTENT>
</CREATE_ATTACHMENT>
</ACTIONS>
</DOCUMENT>
<!-- Updating the
previously created document -->
<DOCUMENT action="update" onerror="break">
<!-- Searching for the
previously created document -->
<SEARCH>
<QUERY>
SELECT
DOCNUMBER FROM DOCSADM.PROFILE WHERE SYSTEM_ID='%doc.SYSTEM_ID%'
</QUERY>
</SEARCH>
<!-- Filling out the
fields in the profile of the document -->
<PROFILE form="%FORM%">
<FIELD name="ABSTRACT">The document from example 1</FIELD>
</PROFILE>
</DOCUMENT>
</HBXMLIMPORT>
File Example2.xml
In this
example we create a folder, search for the document created in example 1, add
it to the created folder and simultaneously update the «Description» attribute
in the form of this folder.
<HBXMLIMPORT version="1.0">
<!--
GLOBAL
VARIABLES:
%AUTHOR_ID%
- the ID of the user in order to specify him as the author of the documents
(the values of the field DOCSADM.PEOPLE.USER_ID)
%TYPIST_ID%
- the ID of the user in order to specify him as the operator who typed the
documents (the values of the field DOCSADM.PEOPLE.USER_ID)
NOTE:
This
example is part of the group of connected examples 1, 2, 3.
To
go through this example correctly, you should go through example 1 first.
-->
<!-- Variable containing
the ID of the standard form -->
<VARIABLE name="FORM" type="static">
DEF_PROF
</VARIABLE>
<!-- Creating a folder
-->
<FOLDER id="fldr" action="create" onerror="break">
<!-- Filling out the
fields in the profile of the folder -->
<PROFILE form="%FORM%">
<FIELD name="DOCNAME">Folder 1</FIELD>
<FIELD name="AUTHOR_ID">%AUTHOR_ID%</FIELD>
<FIELD name="TYPIST_ID">%TYPIST_ID%</FIELD>
<FIELD name="TYPE_ID">DEFAULT</FIELD>
</PROFILE>
</FOLDER>
<!-- Searching for the
document created in example 1 -->
<DOCUMENT id="doc" action="update" onerror="break">
<SEARCH>
<QUERY>
SELECT
DOCNUMBER FROM DOCSADM.PROFILE WHERE DOCNAME='Document 1'
</QUERY>
</SEARCH>
</DOCUMENT>
<!-- Updating the folder
and moving the document found in the previous step to it -->
<FOLDER action="update" onerror="break">
<!-- Searching for the
previously created folder -->
<SEARCH>
<QUERY>
SELECT
DOCNUMBER FROM DOCSADM.PROFILE WHERE SYSTEM_ID='%fldr.SYSTEM_ID%'
</QUERY>
</SEARCH>
<!-- Filling out the
fields in the profile of the folder -->
<PROFILE form="%FORM%">
<FIELD name="ABSTRACT">The folder from example 1</FIELD>
</PROFILE>
<!-- Operations with the
folder -->
<ACTIONS>
<!-- Adding the document
to the folder -->
<ADD_ITEM docnumber="%doc.DOCNUMBER%" display_name="%doc.DOCNAME%"/>
</ACTIONS>
</FOLDER>
</HBXMLIMPORT>
File Example3.xml
In this
example we search for and remove the document and the folder created in
examples 2 and 3.
<HBXMLIMPORT version="1.0">
<!--
GLOBAL
VARIABLES:
%AUTHOR_ID%
- the ID of the user in order to specify him as the author of the documents
(the values of the field DOCSADM.PEOPLE.USER_ID)
%TYPIST_ID%
- the ID of the user in order to specify him as the operator who typed the
documents (the values of the field DOCSADM.PEOPLE.USER_ID)
NOTE:
This
example is part of the group of connected examples 1, 2, 3.
To
go through this example correctly, you should go through example 1 and 2 first.
-->
<!-- Variable containing
the ID of the standard form -->
<VARIABLE name="FORM" type="static">
DEF_PROF
</VARIABLE>
<!-- Searching for the
document created in example 1 -->
<DOCUMENT id="doc" action="update" onerror="break">
<SEARCH>
<QUERY>
SELECT
DOCNUMBER FROM DOCSADM.PROFILE WHERE DOCNAME='Document 1'
</QUERY>
</SEARCH>
</DOCUMENT>
<!-- Searching for the
folder created in example 2 and removing the document created in example 1 from
it -->
<FOLDER id="fldr" action="update" onerror="skip">
<!-- Searching for the
folder -->
<SEARCH>
<QUERY>
SELECT
DOCNUMBER FROM DOCSADM.PROFILE WHERE DOCNAME='Folder 1'
</QUERY>
</SEARCH>
<!-- Operations with the
folder -->
<ACTIONS>
<REMOVE_ITEM docnumber="%doc.DOCNUMBER%"/>
</ACTIONS>
</FOLDER>
<!-- Removing the
document created in example 1 -->
<DOCUMENT action="delete" onerror="skip">
<SEARCH>
<QUERY>
SELECT
DOCNUMBER FROM DOCSADM.PROFILE WHERE SYSTEM_ID = %doc.SYSTEM_ID%
</QUERY>
</SEARCH>
</DOCUMENT>
<!-- Removing the folder
created in example 2 -->
<FOLDER action="delete" onerror="skip">
<SEARCH>
<QUERY>
SELECT
DOCNUMBER FROM DOCSADM.PROFILE WHERE SYSTEM_ID = %fldr.SYSTEM_ID%
</QUERY>
</SEARCH>
</FOLDER>
</HBXMLIMPORT>
File Example4.xml
A lot of
variables, both local and global are used in this example. This example is
intended to be run in a loop many times. Thus, items created at the very end
are removed at the beginning (it is done to make it possible to run the example
again). That is why when you run this example for the first time, you will see
warnings about attempts to remove items that do not exist. On the whole, this
example combines the three previous ones in one file.
<HBXMLIMPORT version="1.0">
<!--
GLOBAL
VARIABLES:
%AUTHOR_ID%
- the ID of the user in order to specify him as the author of the documents
(the values of the field DOCSADM.PEOPLE.USER_ID)
%TYPIST_ID%
- the ID of the user in order to specify him as the operator who typed the
documents (the values of the field DOCSADM.PEOPLE.USER_ID)
NOTE:
This
example can be run as many times as you like because it is made in such a way
that all
documents
and folders created in it are removed before an attempt to create them again.
-->
<!-- Variables -->
<!-- Variable containing
the ID of the standard form -->
<VARIABLE name="FORM" type="static">
DEF_PROF
</VARIABLE>
<!-- Variable containing
the ID of the "Document Name" field of the standard form -->
<VARIABLE name="FIELD_DOCNAME"
type="static">
DOCNAME
</VARIABLE>
<!-- Variable containing
the ID of the "Author" field of the standard form -->
<VARIABLE name="FIELD_AUTHOR_ID"
type="static">
AUTHOR_ID
</VARIABLE>
<!-- Variable containing
the ID of the "Typist" field of the standard form -->
<VARIABLE name="FIELD_TYPIST_ID"
type="static">
TYPIST_ID
</VARIABLE>
<!-- Variable containing
the ID of the "Application" field of the standard form -->
<VARIABLE name="FIELD_APP_ID"
type="static">
APP_ID
</VARIABLE>
<!-- Variable containing
the ID of the "Document type" field of the standard form -->
<VARIABLE name="FIELD_TYPE_ID"
type="static">
TYPE_ID
</VARIABLE>
<!-- Variable containing
the ID of the "Abstract" field of the standard form -->
<VARIABLE name="FIELD_ABSTRACT"
type="static">
ABSTRACT
</VARIABLE>
<!-- Variable containing
the ID of the Microsoft Word application -->
<VARIABLE name="APP_ID" type="static">
MS
WORD
</VARIABLE>
<!-- Variable containing
the ID of the standard document type -->
<VARIABLE name="TYPE_ID" type="static">
DEFAULT
</VARIABLE>
<!-- Variable containing
the system ID of the standard document type -->
<VARIABLE name="TYPE_ID_SID" type="SQL" onerror="break">
<QUERY>
SELECT
SYSTEM_ID FROM DOCSADM.DOCUMENTTYPES WHERE TYPE_ID = '%TYPE_ID%'
</QUERY>
</VARIABLE>
<!-- Documents -->
<!-- Searching for the
previously created document (see below) -->
<DOCUMENT id="doc" action="update" onerror="skip">
<SEARCH>
<QUERY>
SELECT
DOCNUMBER FROM DOCSADM.PROFILE WHERE DOCNAME='doc2'
</QUERY>
</SEARCH>
</DOCUMENT>
<!-- Removing the
previously created document (see below) from the previously created folder (see
below) -->
<FOLDER action="update" onerror="skip">
<!-- Searching for the
folder -->
<SEARCH>
<QUERY>
SELECT
DOCNUMBER FROM DOCSADM.PROFILE WHERE DOCNAME='fldr2'
</QUERY>
</SEARCH>
<!-- Operations with the
folder -->
<ACTIONS>
<!-- Removing the
document from the folder -->
<REMOVE_ITEM docnumber="%doc.DOCNUMBER%"/>
</ACTIONS>