Skip to main content

String Expressions (MDX)

This section describes how to create and use string expressions in InterSystems MDX.

Details

In InterSystems MDX, a string expression can have any of the following forms:

  • A string literal (a double quote character, followed by any characters, followed by another double quote character). For example: "label" or "my property"

  • A numeric literal.

  • An expression that uses an MDX function to return a string. These functions include:

    • PROPERTIES, which returns the value of a property of a member. For example: homed.city.magnolia.PROPERTIES("Population")

      See the reference section Intrinsic Properties for intrinsic properties that you can use.

    • IIF, which returns one of two values, depending on the value of a given logical expression.

    • LOOKUP, which looks up a given key in a term list and returns a substitute string.

    • %LOOKUP, which returns one value from a term list.

  • An expression that refers to a string-valued measure. For example, suppose that you define a calculated member as follows:

    CREATE MEMBER patients.measures.stringtest AS 'IIF(MEASURES.[avg test score]<60, "low","high")'
    

    Then the expression MEASURES.stringtest is a string expression.

  • An expression that uses the MDX concatenation operator (+) to combine other string expressions. For example:

    "string 1 " + "string 2"
    

    For another example:

    "Pop: " + homed.city.magnolia.PROPERTIES("Population")
    
  • A reference to a pivot variable that contains a string value. To refer to a pivot variable, use the following syntax:

    $VARIABLE.variablename
    

    Where variablename is the logical variable name. Do not enclose this expression with square brackets. This syntax is not case-sensitive; nor is the pivot variable name.

    For information on defining pivot variables, see Defining and Using Pivot Variables.

Uses

You can use string expressions in the following ways:

FeedbackOpens in a new tab