Syntax of EXPRESSION statements and FILTER expressions - Intergraph Smart 3D - Help - Hexagon

Intergraph Smart 3D Isogen Isometric Drawings

Language
English
Product
Intergraph Smart 3D
Subproduct
Drawings and Reports
Search by Category
Help
Smart 3D Version
13
Isogen Version
13.0(2016)

The EXPRESSION statement and FILTER expression uses the syntax of the Microsoft DataTable, which is part of the Microsoft .NET Framework.

The content in then following sections is derived from the Microsoft documentation.

Expression syntax

When you create an expression, use the COLUMN Name attribute to refer to columns. For example, if the COLUMN Name for one column is UnitPrice, and another Quantity, an example of a FILTER expression would be as follows:

"UnitPrice > 10 AND Quantity < 100"

When you create an expression for a filter, enclose strings with single quotation marks:

"LastName = 'Jones'"

User-Defined Values

You can use user-defined values within expressions to be compared with column values. Enclose string values within single quotation marks (each single quotation character in a string value has to be escaped by pre-pending it with another single quotation character). Enclose date values within pound signs (#) or single quotes (') based on the data provider. Decimals and scientific notation are permissible for numeric values. For example:

"FirstName = 'John'"
"Price <= 50.00"
"Birthdate < #1/31/82#"

For columns that contain enumeration values, cast the value to an integer data type. For example:

"EnumColumn = 5"

Operators

Concatenation is allowed using Boolean AND, OR, and NOT operators. You can use parentheses to group clauses and force precedence. The AND operator has precedence over other operators. For example:

(LastName = 'Smith' OR LastName = 'Jones') AND FirstName = 'John'

When you create comparison expressions, the following operators are allowed: <, >, <=, >=, <>, =, IN, and LIKE.

The following arithmetic operators are also supported in expressions: + (addition), - (subtraction), * (multiplication), / (division), and % (modulus).

String Operators

To concatenate a string, use the + character.

Wildcard Characters

You can use the * and % characters interchangeably for wildcard characters in a LIKE comparison. If the string in a LIKE clause contains a * or % character, you should enclose those characters in brackets ([]). If a bracket is in the clause, enclose each bracket character in brackets (for example [[] or []]). A wildcard is allowed at the start and end of a pattern, or at the end of a pattern or at the start of a pattern. For example:

"ItemName LIKE '*product*'"
"ItemName LIKE '*product'"
"ItemName LIKE 'product*'"

Wildcard characters are not allowed in the middle of a string. For example, 'te*xt' is not allowed.

Functions

The following functions are also supported:

  • CONVERT converts a particular expression to a specified .NET Framework type.

    Convert(expression, type)

    where expression is the expression to convert and type is the .NET Framework type to which the value will be converted.

    myDataColumn.Expression="Convert(total, 'System.Int32')"

    All conversions are valid with the following exceptions:

    • Boolean can be coerced to and from Byte, SByte, Int16, Int32, Int64, UInt16, UInt32, UInt64, String and itself only.

    • Char can be coerced to and from Int32, UInt32, String, and itself only.

    • DateTime can be coerced to and from String and itself only.

    • TimeSpan can be coerced to and from String and itself only.

  • LEN returns the length of a string.

    LEN(expression)

    where expression is the string to be evaluated.

    myDataColumn.Expression="Len(ItemName)"

  • ISNULL checks an expression and either returns the checked expression or a replacement value.

    ISNULL(expression, replacementvalue)

    where expression is the expression to check and replacementvalue is the value returned if the expression is a null reference.

    myDataColumn.Expression="IsNull(price, -1)"

  • IIF gets one of two values depending on the result of a logical expression.

    IIF(expr, truepart, falsepart)

    where expr is the expression to evaluate, truepart is the value to return if the expression is true, and falsepart is the value to return if the expression is false.

    myDataColumn.Expression = "IIF(total>1000, 'expensive', 'dear')

  • TRIM removes all leading and trailing blank characters like \r, \n, \t, ' ' .

    TRIM(expression)

    where expression is the expression to trim.

  • SUBSTRING gets a sub-string of a specified length, starting at a specified point in the string.

    SUBSTRING(expression, start, length)

    where expression is the source string for the substring, start is the integer that specifies where the substring starts, and length is the integer that specifies the length of the substring.

    myDataColumn.Expression = "SUBSTRING(phone, 7, 8)"