ECExpressions explained - Calculated ECProperty


Applies To 
Product(s):OpenPlant PowerPID; OpenPlant Modeler
Version(s):*
Environment: N/A
Area: Class Editor
Subarea: 
Original Author:Justinas Lipnickas, Bentley Technical Support Group

Overview

An ECExpression is a text string that defines syntax to be evaluated by the ECExpression evaluator. The ECExpressions expression evaluator provides a simple interface for retrieving values from ECInstances. The expression input to the evaluator is comprised of numbers, strings, access strings, symbols, and operators. The syntax for ECExpressions expressions is similar to the syntax for VB.Net expressions. 

Expression components

Simple Expression Examples

String Concatenation

Arithmetic

Comparison

Conditional

Traversing ECRelationships

this.GetRelatedInstance({ECRelationshipClass}:{DirectionIndicator}:{Related ECClass})
where "DirectionIndicator" is 0 for "forward" and 1 for "backward"

For example, to traverse from an instance of Foo to an instance of Boo using the FooHasBoo relationship, and access property B:
this.GetRelatedInstance("FooHasBoo:0:Boo").B

To traverse from an instance of Boo to and instance of Foo using the "backward" direction of the FooHasBoo relationship, and access property F:
this.GetRelatedInstance("FooHasBoo:1:Foo").F

Combined expressions

Operators for Null with Property null

Required ECExpression SymbolSets

When using any of the System functions in the calculated expressions the Required ECExpression SymbolSets needs to be added. Please see the snapshot for additional information on this:

See Also

Functions, which are generally available in the System classes can be reviewed at MSDN website: