Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
  • Welcome
  • Products
  • Support
  • About
  • More
  • Cancel
AutoPLANT | OpenPlant | PlantWise
  • Product Communities
  • More
AutoPLANT | OpenPlant | PlantWise
AutoPLANT | OpenPlant | PlantWise Wiki ECExpressions explained - Calculated ECProperty
    • Sign in
    • -AutoPLANT | Bentley Raceway and Cable Management | OpenPlant | PlantWise Wiki
      • -OpenPlant
        • +CONNECT Services - OpenPlant
        • +Example Configuration - CONNECT Edition
        • +Installations - OpenPlant CONNECT Edition Applications
        • +OpenPlant Download Links & Videos
        • OpenPlant Product Compatibility
        • +OpenPlant Modeler CONNECT
        • +OpenPlant PID CONNECT
        • +OpenPlant Isometrics Manager CONNECT
        • +OpenPlant Orthographics Manager CONNECT
        • +OpenPlant Support Engineering CONNECT
        • +OpenPlant Project Administrator CONNECT
        • +OpenPlant CONNECT Edition-PlantSight Integration
        • +OpenPlant Modeler v8i
        • +OpenPlant Isometrics Manager v8i
        • +OpenPlant Project Administrator v8i
        • -OpenPlant PID v8i
          • +Application Solutions - OPPID
          • -Class Editor - OpenPlant PID
            • 'Locate Missing Reference Schema Files' message while loading Schema in Class Editor
            • ECExpressions explained - Calculated ECProperty
            • How to Get Line Tag info For Pressure Reducing Valve
            • How to Modify/Add Validation State to Components in OpenPlant PID
            • How to Reference a Schema into Primary Schema
          • +Customization - OpenPlant PID
          • +Database - Plant Project
          • +Properties - OpenPlant PID
          • +Release Notes - OpenPlant PID
          • +Training - OpenPlant PID
          • +White Papers/Guidelines - OPPID
        • +OpenPlant Orthographics Manager v8i
        • +OpenPlant Support Engineering v8i
        • +OpenPlant ModelServer v8i
        • +OpenPlant Reporting v8i
        • How to Connect with Bentley Technical Support Team using Microsoft Teams
        • How to Connect with Bentley Technical Support Team using Microsoft Teams via Browser
      • +Bentley AutoPLANT
      • +Bentley Navigator
      • +Bentley PlantSpace
      • +Plant Project Tools
      • +Bentley Raceway and Cable Management
      • i-model Composition Service for S3D
      • Working from home with OpenPlant
      • Working from home with Bentley Raceway and Cable Management
      • Working from home with AutoPLANT Modeler
    • How to Associate the Specification Based on Service in OpenPlant Modeler Connect

     
     Questions about this article, topic, or product? Click here. 

    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

    • String - "Dog"
    • Integer - 1
    • Double - 6.84
    • Symbol - Symbols can be used to supply values to expression evaluator. Symbols can be from an ECInstance via an access string, from an application defined value, or from an application defined method:
      • ECInstance - "ActiveFile.Author" Note-An access string is a limited expression that contains no blanks, no operators and no variable portions.
      • Value - "System.Math.PI"
      • Method - "System.Math.Sin(1.57)"
    • Operators
      • Comparison <, <=, >, >=, =, and <>
      • Conditional IIf (conditional,true-result,false-result)
      • Arithmetic ^ (exponentiation), *, /, \, Mod, +, and -. The division operator "/" always produces a result of type double. The division operator "\" always produces an integer result. 

    Simple Expression Examples

    String Concatenation

    • 1 & "4" -> "14"
    • "Dog" & " and " & "Cat" -> "Dog and Cat"

    Arithmetic

    • 1 + "4" -> 5
    • 2.3 * 3 -> 6.9
    • 12/5 -> 2.4
    • 12\5 -> 2
    • 25 mod 3 -> 1

    Comparison

    • 20 < 10 -> boolean false

    Conditional

    • IIf (500>200,"math ok", "math wrong") -> "math ok"
    • IIf (500<200,"math ok", "math wrong") -> "math wrong"

    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

    • System.Math.Cos(System.Math.PI*45.0/180.0) -> 0.707
    • System.String.Length("Dog" & " and " & "Cat") -> 11
    • System.String.ToLower(System.Environment.GetEnvironmentVariable("USERDOMAIN")) -> bentley

    Operators for Null with Property null

    • ​IfNull(this.Property, "") -> ""
    • IIf (Not IsNull(this.Property)," " & this.Property & " ", "") -> ""

    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:

    • System.String -> http://msdn.microsoft.com/en-us/library/System(v=vs.110).aspx
    • System.Math -> http://msdn.microsoft.com/en-us/library/system.math(v=vs.110).aspx

    • OpenPlant Modeler
    • OPM
    • OPPID
    • Class Editor
    • Generic
    • OpenPLANT PowerPID
    • SELECTsupport
    • Openplant
    • Share
    • History
    • More
    • Cancel
    • JustinasL Created by JustinasL
    • When: Wed, Feb 5 2014 5:45 AM
    • Kestutis Mitkus Last revision by Bentley Colleague Kestutis Mitkus
    • When: Tue, Mar 22 2016 7:05 AM
    • Revisions: 6
    • Comments: 0
    Recommended
    Related
    Communities
    • Home
    • Getting Started
    • Community Central
    • Products
    • Support
    • Secure File Upload
    • Feedback
    Support and Services
    • Home
    • Product Support
    • Downloads
    • Subscription Services Portal
    Training and Learning
    • Home
    • About Bentley Institute
    • My Learning History
    • Reference Books
    Social Media
    •    LinkedIn
    •    Facebook
    •    Twitter
    •    YouTube
    •    RSS Feed
    •    Email

    © 2021 Bentley Systems, Incorporated  |  Contact Us  |  Privacy |  Terms of Use  |  Cookies