How to Write Conditional Parser Expression for Insulation Class in Bentley Class Editor


Applies To
Product(s):Bentley Class Editor
Version(s):CONNECT Edition (10.11.00.260)
Environment:Windows 10/11 (64 bit)
Area:Schema Editor
Subarea: EC Expression
Original Author: Chanchal Mashalkar, Bentley Global Technical Support

Background

As the per the requirement user wants to write an EC Expression in the conditional form. For Example The ECExpression has an IIF statement and when this is the case, both possible expressions need to be considered in the Parser Regular Expression. The two cases here are, with and without a valid Insulation value.

Example:

Insulation defined as NA: A50-100-SERV-222-CS150

Insulation defined as INS (Or any other value): A50-100-SERV-222-CS150-INS

Tag parts defined as:

 

Plant Area                           – A50

Nominal Diameter           – 100

Service                                  - SERV

Number                                – 222

Specification                       – CS150

Insulation                            - INS

Steps to Accomplish

  1. The correct parser expression for above background is:

    ^[?\w]*-(?<NOMINAL_DIAMETER>[?\w]*)-[?\w]*-(?<NUMBER>[?\w]*)-(?<SPECIFICATION>[?\w]*)|[?\w]*-(?<NOMINAL_DIAMETER>[?\w]*)-[?\w]*-(?<NUMBER>[?\w]*)-(?<SPECIFICATION>[?\w]*)-(?<INSULATION>[?\w]*)

    The BAR symbol shown above, is required to split the two possible results to be evaluated.

    Note: Consider the Nominal Diameter is metric unit.

           The Parser Regular Expression is read and if either side of the bar evaluates to TRUE, then it will process the tag and publish this to PlantSight.

 

NOTE: If the units for the project are in imperial, then this will need to be adjusted further. Also note, if any of the other properties used in the expression contain spaces or dashes in the value, the parser regular expression will need to be adjusted further. The adjustments required would be for the inch marks, fraction slashes, spaces, and dashes. Dashes especially because o the tag format contains dashes.

This tool Rad Regex Designer is very valuable when creating parsers and checking them for correctness.

It is free and can be found here: https://rad-software-regular-expression-designer.software.informer.com/

Comments or Corrections?

Bentley's Global Technical Support Group requests that you please confine any comments you have on this Wiki entry to this "Comments or Corrections?" section. THANK YOU!