To Use Expressions in Style Definitions

To create a calculated text property (TB_SQL)

    The following example can be reproduced with the demo data set. You use the TB_SQL text function to define a thematic rule for the stylization of the Landuse feature class. Using the calculated property, you can define the area stylization without using an Oracle view.

  1. In the Maintenance workspace, open an enterprise industry model project.
  2. Select a display model and click Generate Graphic.
  3. In the Display Manager, right-click a feature class, such as LANDUSE_TSUR.
  4. Click Create A Calculation.
  5. In the Create A Calculation dialog box, enter a name, such as LU_Type.
  6. Click Text Function and click TB_SQL.
  7. Insert the SQL command in parentheses after the function. Make sure you use apostrophes for a text string.
    ’SELECT TO_CHAR(MAX(C.ID_TYPE)) FROM LANDUSE_TCEN m,LM_LANDUSE c
    WHERE C.FID=M.FID_CENTROID AND M.FID_TSUR=g.FID’

    The calculated property provides the land-use type that is stored in the centroid feature class LM_LANDUSE.

  8. Click OK to create the calculated property.
  9. In Display Manager, right-click the feature class and click Zoom To Extents.
  10. Right-click the feature class and click Edit Style.
  11. In the Style Editor, add a Thematic Rule.
  12. In the Create/Modify Expression dialog box, click Properties. Under Text Properties, select the calculated property, such as LU_Type.
  13. Define the rule, such as LU_TYPE = ’27’.

    This rule styles the land use polygons that have the land use type LM_LANDUSE.ID_TYPE = 27 = Building Area.

  14. Style the layer.

To create a calculated text property (TB_VARIABLE)

    In the following example, you use the TB_VARIABLE text function to define a thematic rule for the a building style.

  1. In the Maintenance workspace, open an enterprise industry model project.
  2. Select a display model and click Generate Graphic.
  3. In the Display Manager, right-click the feature class, such as LM_BUILDING, and click Create A Calculation.
  4. In the Create A Calculation dialog box, enter a name, such as VARIABLE_BUILDING.
  5. Click Text Function, and click TB_VARIABLE.
  6. Insert the Key in parentheses after the function.

    Make sure you use apostrophes for a text string. (’BUILDING’)

  7. Click OK to create the calculated property.
  8. In the Display Manager, right-click the feature class and click Zoom To Extents.

    The key values for the calculated properties, as well as the user ID, must be specified in TB_VARIABLE.

  9. To work with a TB_VARIABLE that contains 1 or more values, enter an expression, such as the following:
    Instr (
      Concat(
      Concat( ',' ,
      TB_VARIABLE ('Highlight_List_Building' ) ),
      ',' ),
      Concat( Concat( ',', ToString( FID) ), ',' )
    )

To add the key values in TB_VARIABLE

  1. In the industry model explorer, under System Tables, right-click TB_VARIABLE and click Show Form.
  2. On the form toolbar, click New Record.
  3. Enter the key values:

    USER_ID Specifies the user. Enter the TB_USER.ID. In AutoCAD Map 3D, the variable will only apply if this user is connected to the database. For other users, the variable will not take any effect.

    KEY Specifies the key that is used in the calculated property, such as BUILDING.

    VALUE Specifies a value for the key. For example enter the FID of the specific building you want to represent using a special style.

To style a feature layer using a calculated property

  1. In the Display Manager, right-click the feature class and click Edit Style.
  2. In the Style Editor, add a Thematic Rule.
  3. In the Create/Modify Expression dialog box, click Properties.
  4. Under Text Properties, select the calculated property, such as VARIABLE_BUILDING.
  5. Insert an expression, such as VARIABLE_BUILDING = TOSTRING(FID).
  6. Click OK.