Chapter 14. Editing XSDDB Content using TheonUI

None of the workflows covering usage of Theon have gone into any detail regarding direct editing of XSDDB content using TheonUI. This would have to be done to create a model from scratch (when there is no pre-existing physical database to import the system catalog from). Or it could be done to make changes in preference to live database alterations which are subsequently imported, or where changes cannot be imported (such as additional annotation of elements for the purpose of documentation). Editing the content with TheonUI is also the only way to maintain the data for parts of the model that are not realised in a physical database at all: desktops and panels for TheonUI itself; streams configuration for TheonCoupler (although the streams are ultimately functionally realised in the physical database for the most part).

TheonUI must be installed and running on the local host with access to the instance of XSDDB being used. This can be done as simply as below since it is the default behaviour.

theon ui restart

This will start TheonUI (stop and start if already running). For use with Theon this is required to have a local postgresql service running with local user access (and/or running as the local user). See the TheonUI section for more details on configuring and running a TheonUI service.

Using a web browser running on the localhost pointed at http://localhost:1024/ui.html should now provide access to TheonUI. However, this will be the default scheme. To access the scheme used for Theon use the URL below.

http://localhost:1024/model/ui.html

This will provide access to three desktops called Model, Dictionary and Reflection. These can be used to directly view and change the local XSDDB content. These desktops access the XSDDB database on the local PostgreSQL installation. This must be created first for them to work if it does not already exist. See previous Usage section, or just do:

ttkm create

Once all the necessary changes have made export XSDDB and proceed in the same way as described in workflows in previous sections. Changes that only affect the TheonUI and TheonCoupler will need to be propogated separately. See the relevant sections below.

14.1. Model Desktop

The Model desktop is purely for the management of base model data, that ultimately will result in a PostgreSQL physical database and TheonUI scheme instances. The desktop contains a Model panel and a subordinate Cluster panel (which only shows content for the currently selected model). The desktop also has a subordinate panel for each of Entity, Role, Stream and Desktop which only show content for the currently selected model.

The Model panel allows new models to be added and existing models modified (or deleted). The basic model detail fields are described in the technical documentation. There is additionally a box that lists (and allows maintenance of very basic details of) clusters associated with the model.

The Cluster panel allows new clusters to be added and existing clusters modified (or deleted) belonging to the currently selected model. The basic cluster detail fields are described in the technical documentation. It includes a dynamic drop down box for parent cluster selection (used in defining a cluster scheme hierarchy). There are five additional boxes on the panel. One to manage the list of entities held in the cluster. This has a dynamic drop down for appropriate entity selection. One to manage the list of roles held in the cluster. This has a dynamic drop down for appropriate role selection. One to manage the list of streams held in the cluster for TheonCoupler. This has a dynamic drop down for appropriate stream selection. One to manage the list of desktops held in the cluster for TheonUI. This has a dynamic drop down for appropriate desktop selection.

Each of the other panels allows selection only of the associated type by basic detail lookup (tag and name). Each also has a box to manage the list of clusters each entry is held in. This has a dynamic drop down for appropriate cluster selection.

14.2. Dictionary Desktop

The Dictionary desktop is for the management of those parts of the model that will result in structure in a PostgreSQL physical database. It contains a Model panel and subordinate Entity, Role and Stream panels which are independent of each other (but each shows content only for the currently shown model). There are also Attribute, Key, Event and Relationship panels which are all subordinate to the Entity panel (only shows content for the currently shown entity). There is also a Couple panel which is subordinate to the Stream panel (only shows content for the currently shown stream).

The Model panel allows selection of the model against which all other panels operate. There are additionally three boxes that list (and allow maintenance of very basic details of) entities, roles and streams associated with the model. The stream has a dynamic drop down for source entity.

The Entity panel allows new entities to be added and existing entities modified (or deleted) for the currently selected model. The basic entity detail fields are described in the technical documentation. There is additionally a box to hold the list of entities that are dependencies. This has a dynamic drop down for the needed entity. There are additionally five boxes that list (and allow maintenance of very basic details of) attributes, keys, events, relationships (foreign key constraints) and pre-requisites associated with the entity. The event box has a dynamic drop down for process entity selection. The relationship box has dynamic drop downs for primary entity and key selection. The requires box has a dynamic drop down for the pre-requisite entity.

The Attribute panel allows new attributes to be added and existing attributes modified (or deleted) for the currently selected entity. The basic attribute fields are described in the technical documentation. There is additionally a box to hold the list of domain values for an attribute. There are also another two boxes that list the keys and relationships an attribute is part of.

The Key panel allows new keys to be added and existing keys modified (or deleted) for the currently selected entity. The basic key fields are described in the technical documentation. There are also another two boxes that list the attributes in a key and the relationships a key is part of.

The Relationship panel allows new relationships to be added and existing relationships modified (or deleted) for the currently selected entity (as the foreign entity in a constraint). The basic relationship fields are described in the technical documentation. This has a dynamic drop down for the corresponding primary entity and key. There is additionally a box to hold the list of attribute mappings (primary to foreign) in the relationship. This has dynamic drop downs for the attribute on each side.

The Event panel allows new events to be added and existing events modified (or deleted) for the currently selected entity. The basic event fields are described in the technical documentation. This has a dynamic drop down for the process entity. There is additionally a box to hold the list of attribute mappings (updated columns) in the event. This has a dynamic drop down for the associated attribute.

The Role panel allows new roles to be added and existing roles modified (or deleted) for the currently selected model. The basic role detail fields are described in the technical documentation. There is additionally one box that lists (and allow maintenance of the details of) capabilities of a role. This has a dynamic drop down for the associated entity. There is also a box that lists (and allows maintenance of the details of) capability attribute mappings (per column permissions). This has a dynamic drop down for the associated attribute.

The Stream panel allows new streams to be added and existing streams modified (or deleted) for the currently selected model. The basic stream detail fields are described in the technical documentation. This has a dynamic drop down for the data source entity. There is also a box that lists (and allows maintenance of very basic details of) couples in the stream. This has a dynamic drop down for the source entity and target entity.

The Couple panel allows new couples to be added and existing couples modified (or deleted) for the currently selected stream. The basic couple detail fields are described in the technical documentation. There is a dynamic drop down for the source entity and target entity. There is also a box that lists (and allows maintenance of the details of) each bond in the couple. This has a dynamic drop down for the associated entity and relationship (for lookups). Finally there is a box that lists (and allows maintenance of the details of) each pair in a bond. This has a dynamic drop down for the associated attribute for source, target and lookup.

14.3. Reflection Desktop

The Reflection desktop is for the management of the desktops and panels used in TheonUI. It contains a Model panel and subordinate Desktop panel and Panel panel which are independent of each other (but each shows content only for the currently shown model). There is also a Constraint panel which is subordinate to the Panel panel (only shows content for the currently shown panel).

The Model panel allows selection of the parent model against which all other panels operate. There is additionally a box that lists (and allows maintenance of very basic details of) desktops associated with the model.

The Desktop panel allows new desktops to be added and existing desktops modified (or deleted) for the currently selected model. The basic desktop detail fields are described in the technical documentation. There is additionally a box to hold the list of panels linked to the desktop. This has dynamic drop downs for appropriate panel and relationship selection.

The Panel panel allows new panels to be added and existing panels modified (or deleted) for the currently selected model. The basic panel detail fields are described in the technical documentation. It includes a dynamic drop down box for base table (entity) selection. There are additional boxes. One to hold the list of connectors embedded on the panel. This includes a dynamic drop down box for relationship selection and one for connector selection to define a hierarchy. One to hold the list of presenters on the panel (generally just used for grids). One to hold the fields from each connector table and base table on the panel. This includes dynamic drop down boxes for attribute, connector and presenter selection as well as for link (panel) and field selection in cross references. Unfortunately connector hierarchies must be built up in stages as TheonUI does not (currently) support reference to (lookup of) records not yet added into the database.

The Constraint panel allows new panel live data to to be added and existing live data modified (or deleted) for the currently selected panel. Live data defines panel locks, sequences and templates which are then applied to each owning desktop. The panel just contains three boxes. One to hold the list of sequences for the panel. This includes a dynamic drop down box for field selection and also for desktop selection (if the live data is applicable to one specific desktop only). One to hold the list of templates for the panel. This includes a dynamic drop down box for field selection and also for desktop selection (if the live data is applicable to one specific desktop only). One to hold the list of locks (default field values) for the panel. This includes a dynamic drop down box for field selection, cross reference field selection and also for desktop selection (if the live data is applicable to one specific desktop only).

14.4. Usage

14.4.1. Models (Databases) and Clusters

To add a new model use the Model desktop. Define the model first and then save it so all the other elements can be subsequently added. Certain details are mandatory (see the InfoBox entry for each field) such as Tag and Catalog Name. Also make sure to set Realise? if the final physical database is actually to be installable. Use the Clusters box to add the basic (mandatory) details of clusters in the model (if any) - the other details must be set using the Cluster panel.

To add a new cluster use the Cluster panel. Certain details are mandatory (see the InfoBox entry for each field) such as Tag. If the cluster represents a scheme (particular slice or module of the model) then set scheme and for all child clusters of the scheme set the their parent cluster via the drop-down to be the scheme cluster. Cluster hierarchies are otherwise not supported - a cluster can belong to one and only one scheme, a cluster can not be a child of a cluster which is not a scheme cluster, a scheme cluster can not be a child of another scheme cluster. The other boxes on this panel can be used to associate model elements with one or more clusters. These elements must all have been defined via other panels first.

14.4.2. Table Entity Types

Using the desktops to manually create/maintain database tables.

To add a new table use the Dictionary desktop. On the Model panel first query for the specific model to update. By default there would only be one following the basic create and import/reload steps described earlier so an explicit re-query would not be necessary. Then choose the Entity panel and add a new record. Certain details are mandatory (see the InfoBox entry for each field) such as Tag and Catalog Name. For simplicity at this stage do not add any columns, keys, constraints or triggers (do not add records to the Attributes, Keys, Relationships or Events boxes). Since this is a table make sure to set the entity type to Table. Also make sure to set Realise? if the table definition is to be included in the final physical database. Save changes.

Now re-query for the record just added. To define the table columns you can stay on the Entity panel and add a record for each to the box, or you can choose the Attribute panel and add records on that. All the mandatory values can be entered via the box on the Entity panel, but optional values (such as full column description and value sets) need to be done on the Attribute panel. Or enter the basic details quickly in the tabular box view, save the changes, and then use the Attribute panel to add any other information. Make sure to set the type as Column and set Realise?. Save changes.

To add primary (or unique) keys to the table use either the Keys box on the Entity panel (to enter mandatory data only) or use the Key panel. You do need to ultimately use the Key panel in order to actually define the columns associated with a key however. Make sure to set the key type as appropriate and set Realise?. On the Key panel use the Constituent Attributes box to add a record for each column that forms the key. Choose the relevant column from the table using the drop-down. Save changes.

To add foreign key constraints to the table use either the Relationships box on the Entity panel (to enter mandatory data only) or use the Relationship panel. It is necessary to use the Relationship panel to actually define the columns associated with any foreign key constraint. Make sure to set the primary table and key using the drop-downs and set Realise?. On the Relationship panel use the Constituent Attributes box to add a record for each column pairing that forms the foreign key constraint. Choose the relevant column from the current table and from the primary table using the drop-downs. Save changes.

To add triggers to the table use either the Events box on the Entity panel (to enter mandatory data only) or use the Event panel. It is necessary to use the Event panel to define specific update columns associated with a trigger (if any). Make sure to set the process entity (function) using the drop-down and set Realise?. On the Event panel use the Updated Attributes box to add a record for each column that when changed will cause an update trigger. Choose the relevant column from the current table using the drop-down. Save changes.

14.4.3. Other Entity Types

To create other entity types proceed in the same manner. Note though that keys and relationships only apply to the Table and View entity types. With the View entity type they are not realised in the physical database - they provide instead additional "virtual" links between tables and/or views that can be used by TheonUI but would be redundant (or illegal) if actually created. Events only apply to the Table entity type.

Views are created much like tables except that the View type is used and a view definition is required in the container. This will be a suitable SQL SELECT statement. Attributes must be defined for the view as references to the columns returned by the query statement. View definitions can be also be maintained outside of the XSDDB database and loaded using TheonCoupler (see later). Views are actually realised as inline SQL functions with a wrapper view (this is not done here and is part of the transformation process, only the original view as defined can be referenced). To suppress this behaviour use the RawView type instead or containerisation (see below). Use the Requires panel to enter all the other entities the view depends on (other tables and views).

Types are created just like tables except using the Type type.

Enumerates are normally defined as part of a table column definition (attribute values) but are not by default realised so that they are only constrained for use in that specific table. It is not possible in the current structure to define completely table independent enumerates, other than via containerisation (see below).

Non-unique indexes are created automatically for all foreign constraint columns. If these are not wanted the Realise? flag should be unset for them. Indexes are held the Key panel (or Keys box of the Entity panel) with type Index. Additional indexes can also be added for performance if necessary. Indexes can be created with an appropriate key entry (using the Index type) and relevant attribute entrys to define the constitute table columns.

Sequences created with an appropriate entity entry (Sequence type) and named attribute properties. Create these by adding an attribute for each non-default value sequence option (e.g. max cycle, step size, etc). The attribute type should be Property and the name of the attribute should match the relevant SQL SEQUENCE option name (ignoring case). The attribute value can then be used to set the corresponding sequence option value.

SQL and PL/PGSQL functions (normal or trigger) are created with an appropriate entity entry (Function, EventFunction or TableFunction type) and content type setting. A container definition must be included to define the function (the content between DECLARE, BEGIN and END only). Other function languages are partially supported - the content type must be set to External and the definition must be the full function including CREATE statement. Often a function is not defined directly via TheonUI like this but is loaded via TheonCoupler from an external source (either as its easier to edit that way or because it is automatically built from templating). See later for details. The Attribute panel can be used to define each parameter and optionally the return type. To define the triggering events for trigger functions query for the triggering table on the Entity panel and use the Events box to add the trigger definition, selecting the function defined here from the Process Entity drop-down. Further optional details can be added on the Events panel as necessary.

The Container entity type is used to wrap one or more unsupported SQL DDL statements. Anything can be used in the container definition. A realised container will be written out into the generated SQL DDL statements as-is. It can be only ordered within the output by adding a dependency on another entity (which will then preceed it) using the Requires box.

Existing tables or other entity types can all be updated in much the same fashion as above by first querying then making the necessary changes.

The documentation for all objects should be added here as well so that it is self contained as much as possible. The database schema documentation is automatically built from the data maintained here, so the more detail the better. The same data is also used in the InfoBox in TheonUI.

14.4.4. Permissions

To add permissions for tables (currently the only supported entity type to which permissions can be applied) use the Role panel (after first selecting a model on the Model panel if not already done and necessary). Query for a suitable role to add the permission to, or create a role first. Save changes first if added a new role and then re-query for it. Next use the Entitys box to add each entity (via drop-down) and types of permission to be granted. You can also use the Attributes box to select a specific entity and attribute via drop-downs for column only permissions.

Permissions are defined as follows. The entry for the entity sets the default. The entry for an attribute sets an exception. This allows the default to be mostly allow or mostly deny depending which is easiest to maintain. For example, if an entity is added with read access checked then the default will be that all columns are readable. In this case any entry for an attribute for that entity with Swap Read access checked will "deny" read access for that specific column only. Conversely if the read access is not checked for the entity then the default will be that all columns are not readable. In this case any entry for an attribute for that entity with Swap Read access checked will "allow" read access for that specific column only. Choose the most suitable approach based on whether the majority columns should be readable or the majority of columns should not be readable. The attributes box does not apply for the "delete" permission which can only be set for the entity as a whole (any attribute entries in this case will be ignored).

Note that roles need to also be assigned to individual users in PostgreSQL which is a process done outside of Theon as it is site dependent.

14.4.5. Streams

See the section on TheonCoupler for an overview.

Most of the management of incoming streams and coupling sync processes can be configured here. The actual source data for a stream however (if not internal) must be fetched by another process so as to be locally accessable to TheonCoupler and matching the description configured for it. How external data is fetched is a process done outside of Theon as it is stream and site dependent.

Configuration of streams automatically creates addtional table columns for target tables that are used for couple management metadata. It also creates the sync function for processing the couple. The new columns and function will be immediately visible via the Entity panel and Attribute panel. While changes could be made to these automatically generated entries this should not be done - any changes will be subsequently reverted on the next update.

Note that although the sync process function is added (so it can be referenced by other entities) the body definition is not initially available within the XSDDB management database, nor the exported SchemaTree, as it is only created as part of the DDLCoupler transform which also creates additional hidden couple processing support functions and table triggers. These support functions and triggers will not be added into XSDDB via an import from the physical database either as they are specifically excluded from that stream (as they are held in the theon physical database schema). The definition for the couple processing sync function and added table columns will however be imported and exported (into the SchemaTree), but they are ignored in the normal DDL transform (as they are tagged as being maintained by the relevant TheonCoupler stream), and the DDLCoupler transform will ignore the sync function body definition.

Use the Stream panel to create a new stream or query for an existing stream. Certain data is mandatory when creating a new stream. Once done save and re-query for it so couples can be added. A stream may or may not have a specific common data table for all related couples. It certainly will if the stream is handling external data. The data table must first have been separately defined as an entity. If the stream has an upstream external provider source definition that needs to be maintained separately but consistently with the stream definition then a serial number (identity string) can be set to tie the two together. If this is done the stream will fail if the source data does not have in its local filename a matching serial number. This is generally used to correctly map external data coming from reports in BIS and handle changes to those reports cleanly.

Now use the Couple panel to add each distinct synchronisation process driven from the stream data. Some basic details are mandatory such as the couple tag and name. A couple must also have a source and target table (entity rather as the source at least can be a table, view or table function for example). These must be entities that have been separately defined already. The source table may simply be the same as the stream common data table in many cases. Save the changes as presently the data in the other boxes for bonds and pairs cannot be added until the couple has been saved to the database.

Using the Bond box add a Handle bond type for each couple. This is mandatory. It is the columns in the source and target that tie the records together so the content can be syncronised. Then add any number of Column bonds for each couple. Each of these form sets of columns in the source and target the values of which are kept synchronised. Optionally for a bond a separate entity and relationship can be chosen by drop-down. In this case the bond is formed between the source columns and the columns defined in the separate entity, the value then synchronised is that as defined by the relationship to the target. This is for creating foreign key value lookups (where the source table has a column with a unique value but which is not the actual key value required in the target table which must therefore be retrieved by lookup). Note that a Handle bond can be comprised of multiple instances of that type, so that some elements can be from a lookup via intermediate entity and relationship for example. Save changes so the actual pairs can be added to each bond.

Using the Pair box add each source/target column pairing relevant to the bond. Instead of a column from the source entity a literal SQL expression can be used as the left half of the pair (either directly or as a value to map via a lookup relationship). A literal SQL expression can also be used in addition to a column from the source entity, in which case the literal expression will be used but within it any @ character will be expanded as a reference to the source column.

14.4.6. Desktops and Panels

See the section on TheonUI for main documentation but here is a rough structural overview.

  • A desktop contains one or more panels.
  • A panel contains one or more "related" tables in a tree that must always start from a single base table.
  • Each panel in a desktop can be completely independent or can be related to another panel, base table to base table.
  • A panel on a desktop can be related to another panel in one of two ways - forward or reverse.
  • A table on a panel can be related to another table in one of four ways - forward, forwardnormal, reverse and reverselookup.
  • There is no "effective" limit on the number of panels on a desktop, the depth of panel nesting or the depth of table nesting within a panel. However usability issues limit panel nesting to a depth of 2 or 3 and database query performance will limit depth of table nesting within a panel. There is also some restriction on table nesting within a panel depending on the type of relation and data presentation method.
  • Each table on a panel can be "presented" in a number of different ways and with or without certain navigational and editing control aids.
  • A desktop has an associated "live" structure which defines a default search criteria, results ordering and value locking that is specific to that desktop and applies to and across all panels and tables contained within.

To add and maintain the desktops and panels used on TheonUI use the Reflection desktop. Mapping the above to the content in that desktop gives us below.

  • Each desktop is represented as an entry in the Desktop panel.
  • Each panel of a desktop is represented as an entry in the Panel panel. Note that the same panel can be used in any number of different desktops. This entry also identifies to the base table of the panel.
  • The panels and panel to panel relationships within a desktop are represented by entries associated with the desktop in the Links box of the Desktop panel.
  • The table to table relationships within a panel are represented by entries associated with the panel in the Connectors box of the Panel panel.
  • The presentation of each table on a panel is represented by entries associated with the panel in the Presenters box and Fields box of the Panel panel.
  • The desktops default search criteria is represented on a panel by panel basis in the Templates box of the Live panel.
  • The desktops default results ordering is represented on a panel by panel basis in the Sequences box of the Live panel.
  • The desktops default locking is represented on a panel by panel basis in the Locks box of the Live panel.

First on the Model panel query for the relevant model the desktops and panels belong to. This is often not necessary as only one model is normally installed into the XSDDB management database.

Use the Desktop panel to create a new desktop or query for an existing desktop. Certain data is mandatory when creating a new desktop such as tag and name. Once done save and re-query for it so panels can be added. The desktop panel has a box for defining the panels that are included on the desktop. It will not be possible to populate this until the actual panels are defined (or if a new desktop is using panels already available). So first define each panel. A desktop must always have at least one panel.

Using the Panel panel add an entry for the panel. Some basic details are mandatory such as the panel tag and name. Choose the base table for the panel using the entity drop-down. A table or view entity type must be chosen here to be the base table for the panel.

The base table of a Panel has already been defined (above). However, a panel can consist of any number of nested tables. When the panel has other tables embedded these are all defined (by relationship) by adding entries in the Connectors box. Add an entry for each table that is joined directly off the base table only. Use the relevant drop-down to set the associated relationship and its type.

The connector type defines how the child table is embedded on the panel. A Forward relationship is used for a "1:1" or "1:N" type association where the child records are tied to the parent (possibly creating multiple instances of the parent). A ForwardNormal connector is used where a "1:1" or "1:N" type association should be folded into the parent record (only one instance of the parent will ever be shown). A ForwardNormal connector is referred to internally as a Grid and commonly presented with a subsidiary "selector" (for example as tabbed layers or in a tabular format, use Selector to set this). With a ForwardNormal connector it is also possible to set whether the selector type will allow addition or deletion of entries. Forward types follow relationships from a primary table to a foreign table. Reverse types on the other hand follow relationships from a foreign table to a primary table. A Reverse relationship is used for a "1:1" or "N:1" type association where the child records are tied to the parent. There will only ever be one instance of the parent. A ReverseLookup relationship is the same except that the parent table is embedded on the panel as a "dynamic drop down" (or lookup field) to allow immediate selection of any record from the parent and "bring it into" the child.

All connector types except ReverseLookup are presented in a visible box on the panel. The connector entry can define the label and position of the box, features of the box (such as default visibility and displayed layout width) and also whether the box should be removed and the connector content simply embedded with its surrounding context in the panel. The ReverseLookup connector type is always embedded and so none of this applies to that. The indexing value if set will put a row N of M statement in the box label.

Once done save changes and then the next level of connectors can be added. While the connectors box supports representing a hierarchy currently with TheonUI each level of the hierarchy must be done and saved before anything on the next (lower) level can be added. Save changes so the connector data is available for fields.

Any number of tables can be connected off the base table. Nor is there any maximum nested depth down from the panel base table imposed. Connectors can be extended breadth wise at any table point in the tree, not just the base table, and again with no specific imposed limit. The only practical constraint in depth or breadth is usability and performance. There is some constraint on nesting connector types. A ReverseLookup connector type cannot be followed by a ForwardNormal connector type or by another ReverseLookup. Although in principle any number of ForwardNormal connector types can be nested, presentation constraints will generally limit actual depth to two (three at the very most).

Next define any presentation elements using the Presenters box. This is necessary when the panel needs to contain nested grid boxes or tabbed layers for representing some or all fields on connected tables (or the base table). However per-field presenters can also be added if needed. Save changes so the presenter data is available for fields. The use of some types of presenter can artificially constrain the types of nested connector, for example fields from a ForwardNormal connector can be shown in a Grid presenter but it is not possible for that presenter to then contain any fields from a further nested ForwardNormal connector (the fields can still be included outside of the presenter but usability will quickly be lost).

Now define the fields using the Fields box. These are the columns from the base table and from each connected table that need to be available on the panel (although potentially hidden from view, such as key columns). Each field entry represents a single table column to be shown, independently by default. Choose the associated table column (entity attribute) via the drop-down - the choice is constrained by the chosen connector or leave connector blank if the column is to be taken from the panel base table. Other facets of fields can be defined, such as position on the panel, visibility (hidden fields can be used for "live" constraints), whether the field is readonly and a title to override the default (the name of the associated attribute).

Field Facets

The position on the panel is relative to its containing connector group (a completely random field re-positioning is not possible), see below. The presentation position if not set will default to the corresponding attribute position.

Hidden fields (set using visibility) will not be shown on the panel, however they still exist for all other purposes. A hidden field can be used for applying live criteria to a panel which is not user-alterable. Hidden fields are also generally used when key values (of no user relevance) are needed for programmatic update by lookups (see below). Fields can exist multiple times on a panel, e.g. hidden for applying a fixed live criteria but then again visibly so that the resulting values of that field can be seen and further constrained manually by the user if necessary. However, a field can not be used multiple times visibly if more than one instance would be user updateable (i.e. all occurences bar one must be either hidden or readonly, explicitly or implicitly by panel functionality).

When readonly is set the field will be read-only, the user will not be able to alter the displayed value or enter a value during record addition, however the field can still have live criteria applied and can still be used to enter search criteria by the user. Note that some field types (tagged in certain ways within their attribute entry, such as Derived values) will be automatically marked as read only by the actual XML Schema generation and that cannot be overridden here.

The displayed width of a field is set automatically during derivation of panel metadata for TheonUI, usually to a percentage of the actual defined table column limit (as specified in the corresponding attribute entry). Since fields are displayed under a proportional font, using the full defined column limit isn’t usually appropriate. However, sometimes the field is too small when displayed as a result. Use an explicit width value to override this default. For example, if a column on a table has a length of 24 but the content is generally being truncated you might put 32 in width to increase the displayed field width by one third. This only really applies to input text boxes. The derivation also uses a rule so that when the defined length of the table column (in the corresponding attribute entry) exceeds 80 it will be displayed as an multiline text entry area instead of a single line entry field. You can use the height to override this behaviour, setting this to 1 would force the field to be displayed in a single line irrespective of table column width and setting to a number greater than 1 would force the field to be displayed in an entry box with that number of lines. Some presentation elements will (currently) force a single line entry box irrespective of the value here.

By default the label assigned to a field on the panel is the name (or tag if name is blank and raw catalog name if tag is blank) of the table column as set in the corresponding attribute entry. Most of the time this is appropriate. Where it isn’t an explicit name can be specified for the field. Some local field naming conventions which although not mandatory are worth following where possible for user consistency:

  • A boolean column’s field label should always be suffixed with a question mark, e.g. "Status?".
  • A column where the content is always auto-generated by functional processing should always have a field label prefixed with an exclamation mark then a space, e.g. "! Mark".
  • A column where the content is sync’ed from an external source (via TheonCoupler) should always have a field label prefixed with a greater than sign then a space, e.g. "> UUN".
  • A column used as a lookup dynamic drop-down should always have a field label prefixed with a question mark then a space, e.g. "? Person".
  • Any field label which would naturally contain the word "Number" should have that replaced with a hash, e.g. "Card Number" would be "Card#".
  • Any field label which would naturally contain the word "Percentage" should have that replaced with a percent symbol, e.g. "Weight Percentage" would be "Weight%".
  • Any field label which is for a column which is an automatically generated serial identifier should always be suffixed with an at character, e.g. "Course@".

The summary and description can be used to override the default values taken from the corresponding attribute entry. This is necessary when the same column has different meanings in different panel contexts. These are ultimately used on the InfoBox associated with the field.

Field Presenters

By default each field defined above will be shown as a separate HTML form entry field (the actual type and formatting is automatically determined in metadata derivation based on the corresponding attribute entry). You can however represent multiple entry fields within a single multi-row grid (nested tablular entry object). Some restrictions apply. A grid can cross over any number of different nested child connectors but if any are ForwardNormal then the columns of the table associated with that connector must be included first (in position order) in the grid and no other ForwardNormal connectors can be included in the grid at that level.

To group fields into a grid make a presenter entry to represent the grid. Then for each field to be contained in it choose the relevant presenter for the field via the drop-down. All fields with the same presenter will be placed in the one grid.

It is not necessary that all columns from a table in a connector need to be contained in a grid if any one column is contained. So it is possible to present some columns within a multi-row grid element and some columns outside that element (showing one row value only). The multi-row container acts as a selector for the columns not shown in the grid. This is different from where the selector for the connector is defined as a grid, in which case all columns from that connector (and child connectors) are included automatically and do not need a specific presenter added to contain them.

Dynamic Drop-Downs

By default lookup fields are created on the panel whenever they belong to a connector that is a ReverseLookup type. Within a lookup set of fields to mark a column to be displayed explicitly as a dynamic drop-down (with associated functionality) set the dropdown facet. Only one field from a ReverseLookup connector can (currently) be represented as a dynamic drop-down in TheonUI, although it need not be a field from that specific connector but needs to be a field from any of the connector trees down.

For a lookup to work correctly (with a drop-down or otherwise) all the table columns forming the primary key (always taken from the ReverseLookup connector table, even if there are other nested Reverse connectors) and all the table columns in the foreign key (in the parent table of the ReverseLookup connector) must be included as specific field entries. Currently this is not done automatically, although it would be possible to extend XSDDB to do this. Normally these fields would be hidden as there is no need for access beyond programatically within the TheonUI application itself.

Field values in a lookup are blanked before any lookup is performed, so all values the could be matched will be included in the search. This however can be overridden by setting preserve against any of the fields. By not blanking the field the lookup value set will be "reduced" by simple comparison match against all non-blank fields. This is often done when the values of one lookup should be simplified by the resulting value of another lookup, usually when it is an effective parent, i.e. the primary key from the first lookup is used as a foreign key and then part of the primary key in the second lookup (a composite key). Another reason to preserve the value is when it should be set by cross reference, from the value of any other field on the panel (or another panel) - such as from an entirely unrelated lookup.

The key and column relationships for value mapping lookups are produced automatically by derivation of metadata from the SchemaTree itself.

Cross Referencing

Cross referencing another field is done by using the drop-down for a field and panel to identify another fields value. This is used in three different contexts. First it can define that the value to use in the field to filter (constrain) a lookup result set is the value from another field - this only applies when the field is associated with a ReverseLookup connector (and preserve must also be set on that field, see above). Second it is used when link is set on the field so that the field is represented as a button on the panel that will open another desktop/panel. In this case it identifies the field on that desktop/panel to which this fields current value is pushed as a live template criteria. Third when the shortcut column is set for a field it identifies the field on the parent panel which is to provide the values for the shortcut drop-down (and is taken as a temporary template criteria on that field in the parent panel). Note that in all cases the other field (and panel) must have been defined and saved before the drop-down will show them - so an initial save might be necessary first (certainly if referencing a field just added to the panel). Note also that the link and shortcut functionality are not (currently) implemented in TheonUI.

Other Structural Rules

You don’t need to include any columns from a table (base or connected) if not necessary. This is usually the case when a panel is tied to another, in which case no columns from the base table are used. The same column from the same table (base or joined) can also be included more than once - this might be done if it needed to be shown on the panel but also needed to have fixed (not user-alterable) live criteria applied. Fields can effectively be positioned in any order, however they are constrained to be contiguous within their governing connector - this does not mean that they cannot have fields from nested connectors intermixed within but that for any connector the fields must be contiguous within that at the same level. For example, a table A with a ForwardNormal connector to B could have fields as: some columns from A .. all columns from B .. more columns from A, but it would not be allowed to do: some columns from A .. some columns from B .. more columns from A .. more columns from B. However columns from connectors that are not ForwardNormal can be freely interspersed as in the second example above. Irrespective of defined field positioning, final presentation order will be governed first by connector position order - which is also constrained to be depth first then breadth irrespective of any defined connector positioning. So a connector set of the form A → B → C and A → D will be ordered as A, B, C, D (or D, A, B, C) in panel presentation and field positioning will be used within each connector set beyond that. Hence if columns from B were positioned 0 to 5 and those from A 6 to 8 those from A will be shown first on the panel. The only way to influence this behaviour is to set the positions on the connector entries appropriately for the presentation needed (but that would be limited only to ordering A, B, C before or after D in this particular case).

Entry Tagging

The legend value can be used to control tagging. A tag is used to copy the current value of a field (or fields) in a panel into the panel selection tab. For the most part this is used to push a unique value on the base table of a panel up into the selection tab for that panel itself (on the desktop), where it will be automatically propogated to child panels to show what the selected child panel content is actually key’ed against (as the parent panel will itself be no longer visible). The value should be a number from 1. Setting any number number will include that field value in the tag, the number value will determine the position of the field value in the tag - multiple fields are separated by a forward slash character. For example if field 3 has a value 1 for legend and field 7 has a value 2 for legend and the current value displayed in a result set on the panel for field 3 is A and for field 7 is B then the tag will show as A/B on the panels selection tab and on any child panel of the panel as and when selected.

The tablegend value can be used to do the same thing for the selection tabs of connectors when they are shown as tab selectors (so instead of a number for each record in the tab from 1 to N the unique per-record tag is shown instead). Note that this functionality has not yet been implemented in the client.

Completing Desktop

Returning to the Desktop panel an entry can now be added in the Panels box for each panel that has been added above so that they appear on the desktop. A position can be specified to order the panels. From the drop downs select a parent panel and/or a relationship (and the direction to follow it) joining the base table of the parent panel to the base table in this panel. If the parent panel and the relationship are both left empty then the panel is treated as a base panel within the desktop (no parent). Otherwise the panel will be treated as a child of another panel in one of two ways. If the parent panel is selected as above but the relationship is left empty then this is treated as a Tie and the base table on the parent panel and this panel must be the same (they are linked by viture of being panels based on the same base table rather than a specific relationship, in essence this is a "peer-2-peer" link rather than a "parent-2-child" link). If the parent panel is set and the relationship is set then the relationship must be a valid join between the selected parent panel base table and this panels base table. This allows a hierarchy of panels to be constructed within a desktop. A caveat to this is that it is not that obvious to the end user that there is a hierarchy with the current TheonUI desktop panel tabs hence any hierarchy should be limited to a depth of two or at most three for usability. Note that due to limitations in the current TheonUI hierarchies must be built up one layer at a time and saved after each layer has been added.

A desktop and its panel(s) will work without any live criteria defined so its reccommended that doing this is left to a second stage once everything else appears to be working correctly. Live criteria are entered on the Live panel and are used to define default query result ordering (in the Sequence box), search filtering (in the Template box) and entry value locking (in the Lock box). While these are applied against a specific panel they are collated and applied against the specific owning desktop. So at this stage it is probably best to check the desktop and panels display and work as expected in TheonUI before adding the live criteria (if any). See the relevant testing workflow.

Live Criteria

Use the Live panel to add result set constraints and ordering defaults as well as record creation defaults. The Live panel is constrained to whatever the currently selected Panel is so query for (or check) that first. Then use the Sequence box to add any result set ordering. Add an entry for each column you want included in the ordering - select the appropriate field via the drop-down and set the tier (position in the full order set). Similarly use the Template box to add any result set filtering. Again add an entry for each filter to apply selecting the appropriate field via the drop-down. All templates are and’ed together to form the query restriction.

A pattern match is a regular expresion and a template value for a pattern match can use standard POSIX Regular Expression syntax. A pattern match is case insensitive by default, "xyz" will match "XYZ" and "xYz" etc.

With Hook Left the template value is anchored to the start of the field, hence only matching content at the beginning of the field (ignoring anything trailing at the end). With Hook Right the template value is anchored to the end of the field, hence matching only content at the end of the field (ignoring anything leading at the beginning). With No Hook the template value floats and can match content anywhere within the field. With Hook Both the template value is anchored to the start and the end of the field and consequently will only match the whole content of the field.

  • "xyz" with Hook Left would match "xyz", "xyzabc" but not "mnoxyz"
  • "abc" with Hook Right would match "abc", "xyzabc" but not "abcmno"
  • "mno" with Hook Both would match "mno" but not "mnoxyz" or "abcmno"
  • "abc" with No Hook would match "abc", "xyzabc", "abcmno" and "xyzabcmno"

An Exact Match template is a direct value comparison. The first character(s) of the template value indicate the type of match. If the first character is not any of those listed below then an equals comparison is assumed (same as if = was put as the first character). All comparisons are done using the PostgreSQL LOCALE.

  • "99" means field content must exactly match "99"
  • "=99" means same as above
  • ">99" means field content must be greater than "99"
  • "<99" means field content must be less than "99"
  • ">=99" means field content must be greater than or equal to "99"
  • "⇐99" means field content must be less than or equal to "99"
  • "1..99" means field content must be greater than or equal to "1" and less than or equal to "99"

As a special case to search for blank (NULL) values just = used alone in a field will match these.

In all pattern types and Exact Match you can use ; (semi-colon) to match any one of multiple values in the same template. Examples below.

  • "abc;xyz" with Hook Left will match either "abc" or "xyz" at the start of the field
  • ">24;8;0" with Exact Match will match any value greater than "24" as well as the values "8" or "0"

All template matches can also be reversed (to entries that don’t match it) by setting invert.

Template matches can be localized to apply to just their associated connector by setting connector. In SQL parlance this means it is applied at the "join" clause for the connectror instead of the overall "where" clause. Effectively it isolates the criteria from affecting the primary search - i.e. no matching records from the connector table(s) will not cause the panels base table to also have no matches, but only matching records from the connector table(s) will be shown if there are any matches. This would commonly be used on templates applied to ForwardNormal connectors.

All template matches can be banked and then or’ed together by bank if necessary (using bank to group). Finally use the Lock box to add any default values for columns when inserting (or querying) records. Add an entry for each default value to apply selecting the appropriate field via the drop-down. A cross reference field (and optionally panel) can also be added via the drop-downs. In this case the lock value will depend on the value in that field at the time a record is being added.

Both template and lock entries can use dynamic to define the match value or lock value to be determined by a literal SQL expression. These expressions are only processed once, whenever the desktop is opened. The value resulting from running the SQL expression is used instead in the corresponding live criteria.

All live criteria can have lookup set. When set this means the criteria is only applicable to the search run to get the set of values for a ReverseLookup connector, as opposed to the normal panel search. This is often necessary as different criteria need to be applied to the same fields. The lookup has no relevance to live criteria defined for fields that are not part of a ReverseLookup connector.

A specific desktop can also be associated with any live criteria. If done this will constrain that specific live criteria so it only applies when the panel is used on that specific desktop. If not defined criteria apply on all desktops to which the panel is added.