Adding a reusable variable - AcceleratorKMS - Version 3.12 - Help - Hexagon

AcceleratorKMS Template Writing

Language
English
Product
AcceleratorKMS
Search by Category
Help
AcceleratorKMS Version
3.12

If a variable with the same value can be used in multiple instances, consider using a reusable variable.

About this task

When reusable variables are used in a template, the values for the variable are defined in the asset profile. This works especially well when the same variable is used multiple times across templates, as the value is only defined once. Every time it is used, the value defined in the asset profile replaces the variable in the generated content.

And for basically the same reason, reusable variables work nicely in a traditional content as well. This is especially true when writing a traditional content that is going to be copied for another similar traditional document. When using reusable variables in a traditional document, the values are defined at the top of the document, just below the information section.

Keep in mind that reusable variables can be added to a statement's text or the More details field.

If you reuse a statement that includes a reusable variable, do not rename the variable. If you change the variable name, all values associated with it are removed in every instance where that statement is used (including other documents that use that same statement). For example, if the statement uses the variable name {namePump} and you rename it to {namePumpWater}, this would cause all associated values of {namePump} to be lost. Create a new statement with your preferred variable name instead.

Procedure

  1. Place your cursor where you want the variable to appear. Variables can be added to Block names, Statement fields, or More details field within the statement field.

    • To add a variable to More details , you must be in the Statement Editor.

    • When using variables within a block in traditional content, you must define the variable values AFTER the block is saved. Otherwise, the values are lost.

  2. On the statement editor toolbar, click the {var} icon.

    The system displays the variable text field below the statement editor.

  3. To search for an existing variable, leave the variable Type as All; otherwise, select the variable type as either Asset, Numeric, or Text.

  4. In the Variable field, enter the name for the variable.

    The system displays a list of possible variables.

  5. If you chose an existing reusable variable, click Use. Otherwise, click Create and complete the fields.

    The fields vary depending on what Asset type you chose.

    Reusable variable fields

    Field

    Description

    Name

    Identifies the name of the variable. Variables can be created in a Block name, and the Statement and More Details sections.

    Variable names can only contain letters, numbers, and underscores. They cannot contain spaces.

    Type

    Identifies the type of content used for the variable. Options include:

    Numeric: Use for variables containing numeric units of measurement, such as pressure, temperature, or time. Note: Consider the implications of reuse. This variable only allows a numeric value so if the unit of measure might vary between content, consider using a text variable instead to accommodate the unit of measure.

    Text: Use for variables containing text and/or a combination of a numeric value and text. A text variable can also contain white space or special characters. It is the most flexible of all variable types.

    Asset: Use when you need to refer to a specific asset in a statement or a sub template. The asset ID must already be defined in AcceleratorKMS.

    Units

    If you choose Numeric as the variable type, you must enter a value in Units , such as psi, °C, or minutes. The unit value you specify in the Units field displays with the variable value when used in content.

    For example, you could create a numeric variable to specify the maximum pressure in units of psi. So, the statement, "Pressure asset to pressureMaximum with Nitrogen." could become "Pressure asset to 15 psi with Nitrogen." in your content.

    Asset type

    If you choose Asset as the variable type, you must select an asset type.

    Description

    Text used to describe the variable and its purpose.

Results

The reusable variable appears where you last placed your cursor and in the Reusable Variables list.

When you save the statement, the reusable variable must be defined:

  • For templates: On the affected asset profile page in the Variables section.

  • For traditional documents: At the top of the document.

After the reusable variable value is defined, the defined value appears:

  • For templates: In the affected asset profile.

  • For traditional documents: At the top of the document in which it is used.