Home Search

DriveWorks Pro 21
Extract Variable

Send Feedback

Extract Variable

The Extract Variable function allows variables to be created directly from the Rule Builder.

Anything entered in the rule editor can be extracted to create a new variable.

Any occurrences of the selection can be searched for in every rule within the project, and be replaced with the new variable.

Extract Variable

To extract a portion of the rule you are currently building to a variable, in the rule builder:

  1. Select the portion of the rule to be converted into a variable.

    Right click on the highlighted portion and select Extract Variable.

  2. Enter a name for the variable in the New variable name field.

    DriveWorks will check the name entered is valid.

    The field where the name is entered gives feedback on validity by remaining red when there is an error, and turning green when the name is acceptable.

    The OK button on the Extract variable dialog will be disabled until a valid name is entered.

    Causes of unacceptable variable names include:

    • Blank name.
    • Forbidden characters - (only alpha and numeric characters can be used for variables).
    • Variable name in use.
  3. Replace in all rules.

    If the rule (to be extracted to the variable) occurs in other ares of the Project, each occurrence can be replaced with the new variable.

    Check the box marked Replace in all rules.

    Click OK.

  4. Review the rule instances in which the highlighted portion was found.

    De-select any instance that is not required to be changed.

    When the review is complete, click OK to apply the changes.

    Replace in rules dialog

    The results are displayed with the following information:

    • Selection

      All found occurrences will be selected by default. To exclude an occurrence from the change uncheck this column.

    • Name

      This is the name of where the occurrence was found.

      For instance: the name of a Variable, a Control Property, a Document or Model Parameter, etc.

    • Old Rule

      This displays the existing full rule, with the portion that has been found highlighted.

    • New Rule

      This displays the modified full rule, with the portion that will be modified highlighted.

    • Type

      This is the parent type.

      For instance: Variable, Control, Document or Component Sets, etc.

    • Location

      This is the full path to where the occurrence was found.

    The filter box allows the results to be filtered.

    For example:

    To display just variables, enter:

    Type: Variables

  5. Click OK in the Rule Builder.

Replace In Rules is also available directly from the Rule Builder (without requiring to Extract Variable).

DriveWorks Quick Tips

DriveWorks Quick Tips: Search and Replace Rules

We’ve all done it, we made a few rules with a constant number, thinking that it’s only one or two rules. Then it becomes 10… and then its 50, and then suddenly that value needs to be changed. Now you need to find all the rules that have that value and replace them with the right value, but the rules are long and complex and searching each one will take hours! This is where DriveWorks has your back.

DriveWorks Quick Tips are a series of 1 minute videos, available on YouTube, that explain specific functionality. View all Quick Tips