Using Object-based Dynamic Lists Instead of Catalogs

Catalogs are used to limit the entries of a field to only those defined. Catalogs are part of the schema definition. Changes can only be made manually by administrators.

When users who are responsible for a domain need to change catalog values often, the best way is to use fields of type String that are classified as Dynamic lists, together with a client-side script.

In the following example, catalog values are stored as single objects of the object type QA-dynamic-list.

This object type consists of the following fields:

Technical Field NameDescription
qavalueValue that is offered in the selection list or dialog for the dynamic list field
createIf set to TRUE, the value is shown in the create situation
editIf set to TRUE, the value is shown in the edit situation
de, en, ruThe values are descriptions in the corresponding languages. Descriptions are shown in addition to the value in the selection list or dialog.
externalNot relevant in this case

Catalog Administration in the client

Users with create and edit rights for this object type are able to administer the values using the client.

Selecting a Value in the Dynamic List

The following screenshot shows the selection dialog in the creation situation (definition language set to English).

Script for the Dynamic List

The script (below) has to be given in the object type with the field (here dynamiclistfield) of type String and class Dynamic list.


Figure: Attribute Classification of field type String set to Dynamic list 

Script example for dynamic list determination
// prepare variables
var qadynlist = scope.model.dynamiclistfield;
var myRequest={};
var language=scope.api.session.getUser().schemalocale;

// prepare control for situation
if ( scope.situation == 'CREATE' ) { 
	 myRequest={create:true};
}
if ( scope.situation == 'EDIT' ) {
	 myRequest={edit:true};
}
scope.api.dms.getResult(myRequest,'qadynlist').then( 
	function(result) {
		var dynlist = [];
		result.forEach(function(row) {
			if( row.data.qavalue ) {
				dynlist.push({
					value: row.data.qavalue,
					description: row.data[language]  // control which description field should be used
				});
			};
		});
		qadynlist.setList({
			config: {
				allelementsselectable: true
			},
			entries: dynlist
		});
	},
	function(error) {
		scope.api.util.notifier.error('Could not determine values',error);
	}
);

For more information, see documentation of dynamic list scripting.

Restrictions of Dynamic Lists

Unlike catalogs in a schema, the values of dynamic lists cannot be localized.