SESSION - Variables

Workflow Manager Developer Guide

HGD_Variant
15.00
HGD_Product
GeoMedia Smart Client
HGD_Portfolio_Suite
Platform

The "default" navigation-concept in a workflow can be regarded as follows: Workflow-Node without a Controller placed on this node → Workflow-Node with List-Controller and Form → Workflow-Node with Form-Controller and Form

...
<WorkflowNode id="1" label="Administration"> 
    <WorkflowNode id="10" label="Car-Overview" controller="List" form="CAR">
        <WorkflowNode id="100" label="Edit Car" controller="Form" form="CAR" follownode="10">
        </WorkflowNode>
    </WorkflowNode>
</WorkflowNode>
...

When users reach the List-Controller "Car-Overview", they select a list-element (which matches a row in the database) that is forwarded to the Form-Controller. Now the Session-Variable contains information about the Primary Key (for example, named "ID") of the selected car. The Session-Variables are stored in the SEC_SESSION table of the used Database/Schema together with the Session-ID of the user.

The session variable of the example above now can be referenced via

{SESSION.CAR.ID}

in both, the FormSettings.xml:

...
<FormField name="OWNER" label="Car Owner:" type="textfield" datatype="string" 
persisted="false" required="false"
defaultvalue="SQL[SELECT NAME FROM PERSON WHERE ID=(SELECT PERSON_ID FROM PERSON_CAR WHERE CAR_ID={SESSION.CAR.ID})]"/>
...

... and the WorkflowSettings.xml:

...
<WorkflowNode id="100" label="Edit Car" controller="Form" form="CAR">
  <WorkflowTrigger name="DeleteCarReferenceTrigger" type="DbTrigger" method="action" condition="true">
    <Param name="Sql" value="SQL[DELETE FROM PERSON_CAR WHERE CAR_ID={SESSION.CAR.ID}]"/>
  </WorkflowTrigger>
</WorkflowNode>                
...

If a Variable-Value other than the Primary-Key-Value is needed in the workflow, any other necessary FormField-value can be stored in the SEC_SESSION table by defining a saveinsession="true/false" attribute at the FormField-Element. If the saveinsession-variable is set true it always set tableName.columnName:

...
<FormField name="PHONENUMBER" label="Telephone:" type="textfield" datatype="string" saveinsession="CONTACT.PHONENUMBER"/>
...

As soon as the belonging table is stored (action="save"), the FormField marked with saveinsession will be persisted in the SEC_SESSION table and can be called later through {SESSION.TABLE_NAME.COLUMN_NAME}.

...
<FormField name="PHONENUMBER_NEW" label="Telephone:" type="textfield" datatype="string" defaultvalue="{SESSION.CONTACT.PHONENUMBER}"/>
...

Set session variables in the SEC_SESSION table at a Workflow-Node:

If the user wants to save session variables at Workflow-Node-Level (for example, before the Form-Controller is opened ), this is done in the workflow inside a WorkflowTrigger.

...
<WorkflowNode controller="Form" form="PERSON" id="22" label="Enter new Person" emptyform="true" follownode="2">
  <WorkflowTrigger name="SetKeyTrigger" type="SessionTrigger" method="before">
    <Param name="Keys" value="ACTUAL_PERSON.ID={SESSION.UNID.CURENT}{SESSION.PERS.ID}"/>
  </WorkflowTrigger>                 
</WorkflowNode>                
...

Evaluation of a SESSION-Variable:

The SESSION[KeyExists(...)] is used to find out if a variable has been set in the SEC_SESSION table. The result of the query is a boolean value (true/false).

Syntax: SESSION[KeyExists(NAME_OF_THE_KEY)]

Example:

<WorkflowNode id="4" ... condition="SESSION[KeyExists(PATIENT.GUID)]" >

DEPENDENCY - Variables: Using dependency variables, you can get access inside the form definition in the FormSettings-XML to the current value of other FormFields.

Example: Create a list of themes depending on the selected project.

 ...
 <FormField name="PROJECT" label="Project:" type="combobox" datatype="string" 
  lov="SQL[SELECT NAME FROM PROJECT ORDER BY NAME]"/>
 <FormField name="THEME" label="Theme:" type="combobox" datatype="string" 
  lov="SQL[SELECT NAME FROM THEME WHERE PROJECT_ID={FORM.PROJECT}]"/>
 ...

ESCAPE-Characters:

For the usage in the Workflow-XML, the most important escape-characters are listed below:

Character

Escape-Character

<

&lt;

>

&gt;

&

&amp;

"

&quot;