Apama 10.3.1 | Apama Documentation | Building and Using Apama Dashboards | Building Dashboard Clients | Reusing Dashboard Components | Using Composite objects | Using substitutions with Composite objects
 
Using substitutions with Composite objects
The Composite object supports the setting of substitutions on the file displayed in the composite. It has a single substitutions property where the name and value of one or more substitutions can be specified.
Substitutions are specified as a string with the following syntax:
$subname:subvalue $subname2:subvalue2 …
*If a substitution value contains a single quote character, it must be escaped using a backslash.
$subname:/'Quoted Value/'
*If a substitution value contains a space, the entire value must be enclosed in single quotes. Do not escape these single quotes.
$subname:'Value with Spaces'
*The substitution names should not contain any of the following characters:
Colon (:), pipe (|), period (.), comma (,), semi-colon (;), equals (=), brackets (< >, ( ), { }, [ ]), quotation marks (' "), ampersand (&), slashes (/ \)
Note: Substitutions and variables in a Composite object are scoped to the object. If a dashboard contains a Composite object, and both the dashboard and the Composite object have the substitution $mySub defined, changes to the value of one will not affect the other. The Composite object will have its own value as will the dashboard.
When you use a Composite object to display detailed information on a selected scenario instance or DataView item, it is often easiest to set the substitution $instanceId on the composite. Setting $instanceId allows you to define in the rtv file displayed in the composite attachments and commands which filter on $instanceId as you normally would in other dashboards.
For this use case, the simplest way to set $instanceId as a substitution on a composite is to attach the substitutions property of the composite object to the apama.substitutions variable of the selected instance.
The value of apama.substitutions is a string formatted for use as the value of the substitutions property. An example of the value for an instance of the tutorial scenario is the following:
$instanceId:default.tutorial.21
This results in the substitution $instanceId being set to default.tutorial.21 in the rtv file displayed in the composite. Attachments and commands filtering on $instanceId would be tied to this instance.
Note: If the file displayed in a Composite object has buttons or other objects which run Apama commands to edit or delete an instance of a scenario, you need a substitution set to the ID of the instance. This substitution can be used as the filter on the command to identify the instance that the command operates on. The standard substitution to use is $instanceId.
Note: Variables cannot be used in filters on attachments or commands. You cannot define a variable instanceId, use it in the filter, and set the value as a property on a composite object.

Copyright © 2013-2019 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.