Configuring parameters for a Script schematic attribute

Requisito previo:

An attribute Script is an attribute whose values will be computed by a VB script. This type of attribute may be used instead of a Function attribute in many cases. Configuring Script schematic attribute parameters consists of specifying that VB script.

Script attributes can be configured on schematic feature classes or diagram templates. The steps below explain how to configure the VB script expected for this type of attribute.

To create the schematic attribute itself, you must start with the steps detailed in the Creating attributes on a schematic feature class or Creating attributes on a schematic diagram template topics and select Script when specifying the attribute Type at step 6. The steps below concern the specific Script attribute configurations that are expected to be operated at step 7 in those topics.

When selecting Script as the Type for a new schematic attribute, the Properties tab displays as follows:

Sample Script attribute - Properties tab, initial content

You then have to configure the VB script that will compute the attribute values:

Pasos:
  1. Type the VB script you want to be executed to evaluate each attribute value in the Script section.

    Any VB Script statement (Looping, If, Select,... statement) or VB expression can be interpreted.

  2. If you need another attribute value as a parameter in your script do the following,
    1. Type its exact name in the VB script.

      You may also have to type the name of the attribute itself in the VB script:

      • A VB expression computes a direct value that is automatically applied to the attribute. In this case, you don't need to use the attribute name itself in the expression. For example, the following expression script to compute the SampleAttribute_Script attribute based on another Power attribute is OK; there is no ambiguity:
        Power/1000 & " KWatt"
      • With a VB statement, there is no direct computed value, and you need to use the attribute name in the script to apply the desired value to the attribute. The following sample script is also based on another attribute—Station_Capacity. It computes the SampleAttribute_Script attribute values. For each possible value, the script code needs to use the SampleAttribute_Script attribute name for the script to be correctly interpreted.
        select case Station_Capacity
        case 1, 2, 4, 6
        SampleAttribute_Script="A"
        case 3, 8
        SampleAttribute_Script="B"
        case else
        SampleAttribute_Script="Unknown"
        end select
        Here is another script sample that works from three other attributes, Mode, Category, and Size. Depending on the value of the Mode attribute, the LabelToDisplay script attribute will return either the Category attribute value or the Size attribute value:
        if Mode=1 then
        LabelToDisplay=Category
        else
        LabelToDisplay=Size
        end if
        

    2. Click Add Parameter button Add Parameter.

      A new parameter item is added in the Parameters column below

    3. Click the drop-down arrow on the parameter item and select the existing attribute expected as a script parameter.
      Sample Script attribute - Specifying parameters
    4. Repeat steps b and c for each required parameter.

To put an end point to the Script schematic attribute creation, you then need to specify the parameters available in the Storage Mode and Evaluation Mode sections as explained in steps 8 through 11 in the Creating attributes on a schematic feature class or Creating attributes on a schematic diagram template topics.


7/11/2012