Expressions
A dynamic property expression allows you to source information from other places like a custom property, another dynamic property of the Components or a property in another entity, for example, a Deployment Target or an Environment.
This page includes the following:
-
Expressions are always in curly brackets:
{@target/custom/protocol}://{/tomcat/host}:{/tomcat/port}
In this example you can see three expressions that are concatenated in a single property expression: an expression called protocol, and expression called host and an expression called port. These values are separated by various symbols like colons and slashes. Each expression is surrounded by curly brackets. Together, they form another separate dynamic property.
Tip: To learn how to use curly brackets in an expression, read the section: Using Curly Brackets in Expressions.
-
Other entities (Deployment Targets, Applications, Components) are referenced by: @entity type
@target: references the Target that the Component is associated to in the Profile that is used at runtime. For example, TRG1_QA1 Tomcat
-
If custom is in the property name, you know that this is the expression getting the property from the UI screen. Customs sources a value that is defined in one of the custom property fields.
@target/custom/host: sources the value that is stored in the host field of the target UI screen.
-
You can also source system properties that are found in the general category; things like name, folder, or owner. Sourcing the name of an entity can be useful if you want to name databases based on each environment. Then, when you execute the script that creates that database, the naming could use the following property:
{@environment/system/name}: Name of the Environment - development.
The following expression can be entered to assign a unique identifier to your database:
{@environment/system/id}
- Other symbols can be also used, like / for URL directories.
Note: For security reasons, using/referencing “foreign” protected properties is not supported. You can define protected properties at application level and can reference them at component level to use them for component deployment Workflows.
Absolute paths replace the expression with the value of another property (referenced by its full name) which is available on the same entity. If the other property is not found, a warning is logged and nothing is returned.
-
/world
Value: World
Value after evaluation: World
-
/hello_world
Value: Hello {/world}!
Value after evaluation: Hello World!
-
/example
Value: Example: {/hello_world}
Value after evaluation: Example: Hello World!
-
/missing
Value: Missing One{/thousand}!
Value after evaluation:Missing One!
Note: If the value of the
/thousand
property is empty, the property is ignored in the evaluation.
Expressions not starting with a / searches for the variable in the same namespace.
-
/database/oracle/dbname
Value: My Oracle Database
Value after evaluation: My Oracle Database
-
/database/ms/dbname
Value: My Microsoft Database
Value after evaluation: My Microsoft Database
-
/database/oracle/connection
Value: Database={dbname}
Value after evaluation: Database=My Oracle Database
-
/database/ms/connection
Value: Database={dbname}
Value after evaluation: Database=My Microsoft Database
-
/database/connection
Value: {oracle/connection}
Value after evaluation: Database=My Oracle Database
You can use expressions within expressions. The expressions are evaluated from inner to outer.
-
/database/oracle/dbname
Value: My Oracle Database
Value after evaluation: My Oracle Database
-
/database/ms/dbname
Value: My Microsoft Database
Value after evaluation: My Microsoft Database
-
/use_database
Value: oracle
Value after evaluation: oracle
-
/connection
Value: Database={/database/{use_database}/dbname}
Value after evaluation: Database=My Oracle Database
Note: If the types of referenced dynamic properties differ they get cast automatically to the correct type (if applicable).
Dynamic properties can reference properties of related entities which are available at deployment time. For example, a database component may access the ip-address property of the target on which it gets installed. The component may be installed on multiple deployment targets, so the property value changes depending on the component-target combination which gets currently evaluated.
During deployment, the properties are always evaluated for a single component on a single target. Therefore the dynamic properties of the following entities can be referenced:
-
component
The Component that is currently being evaluated
-
application
The Application to which the evaluated Component belongs.
-
deployment_package
The Deployment Package which is currently being installed
-
workflow
Executed workflow
-
environment
Environment on which the deployment is executed
-
target
Target on which the Component is installed
To access the dynamic properties of a related entity, use the following expression {@[related entity]/[property name]}. If no related entity is defined in the expression, the originated context is the component. If a dynamic property that is fetched within an expression is overridden on another entity the overridden value is evaluated.
If the related entity or the property on the related entity is not found a warning gets logged and an empty string returned.
Example:
-
Properties of an environment:
-
/type
Value: prod
Value after evaluation: prod
-
-
Properties of a database server target within the environment
-
/db-type
Value: oracle
Value after evaluation: oracle
-
-
Properties of a component that gets installed on the database server target:
-
/connect-string
Value: provider={@target/db-type};dbname={database-name}-{@environment/type};
Value after evaluation: provider=oracle;dbname=MyDB-prod
-
/database-name
Value: MyDB
Value after evaluation: MyDB
-
The following global properties are available in an expression {@global/[property name]}:
-
username
Name of the user that executes the workflow
-
userDepartment
Name of the department the user belongs to
-
client
Name of the client where the user was created
-
token
Authentication token for the user that executes the workflow
-
CallBackURL
The CDA URL where the workflow execution was started
-
login
The login object that is used for the workflow execution.
-
aePort
Automation Engine port
-
AeHost
Automation Engine host
-
AeSystemName
Name of the Automation Engine system
In addition to the predefined related entities, all linked components that are defined via Component Links can be accessed like related entities via the link name. See: Working with Component Links
When deploying a component to targets and the targets have a deployment handler (see Deployment Panel on targets), the properties of the component are not evaluated against each endpoint/target individually, but only once against the deployment handler. Some Actions expect information of the actual endpoints. To access information of the endpoints, use the expression {@endpoints/[property name]}. This returns the property values of all endpoints that are managed by the deployment handler that gets currently evaluated, separated with commas.
Notes:
- If the target that gets evaluated is not a CDA for other targets, @endpoints is the same as @target.
- Components are deployed directly to deployment handlers too (if the required role of the component is set accordingly).
- The endpoints are ordered by their internal IDs, which ensures a consistent order if multiple {@endpoints} expressions are used.
- The @endpoints expression creates a sub evaluation for each endpoint where each of the sub evaluation changes the @target related entity to that of the endpoint. The other related entities (for example, package, component links, and so on) would not be changed.
Using Curly Brackets in Expressions
If you want to use curly brackets in expressions, you must escape them. To do so:
- Define a Dynamic property of type static text that contains the open bracket and another one that contains the closing bracket. For example,
/cb_open = {
and/cb_close = }
- Use these Dynamic Properties in expressions wherever needed. For example, if you want a connection string to look like this:
SQLDRIVERCONNECT=ODBCVAR=SNNNNNRN,Driver={SQL Server Native Client 11.0};Server=tcp:dbserver,1433;Database=ae_db;Uid=ae_user;PWD=--XXX;MARS_CONNECTION=Yes
Define the dynamic property expression as follows:
SQLDRIVERCONNECT=ODBCVAR=SNNNNNRN,Driver={/cb_open}SQL Server Native Client 11.0{/cb_close};Server=tcp:dbserver,1433;Database=ae_db;Uid=ae_user;PWD=--XXX;MARS_CONNECTION=Yes