Home Search

DriveWorks Pro 21
What's New Create Variables

Send Feedback

Create and Edit Variables Directly from the Rule Builder

Variables can now be created directly from the rules builder.

This is an essential new feature for making those long rules more straightforward on the fly!

Additionally variables used in existing rules can now be edited by launching additional child Rule Builders from anywhere in your project. This saves having to close the current task, open the define variables task to correct variables.

Strings, calculations, formulas, functions, references and everything else used within a rule can be extracted to create a new variable directly in the Rule Builder.

An option also exists to find all occurrences of the selection, in every rule within the project, and replace each 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.
  2. Right click anywhere in the rule editor window, to display the Context Menu.
  3. From the Context Menu select Extract Variable, to launch the Extract Variable dialog.
  4. Enter a name for the variable in the New variable name field and click OK.

  5. 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.

Replace in all Rules

The Extract variable dialog has an option to Replace in all rules.

Selecting this option will replace all occurrences of the rule throughout the project.

Once OK is selected, and with the Replace in all rules option selected, a new dialog will open.

The Replace in all rules dialog will show all rules that will be changed.

There is an option for not changing a particular rule by deselecting the check box next to the required rule.

The Replace in all rules dialog displays the old rule - along with the portion that will be replaced highlighted. It also displays how the new rule will look with the created variable highlighted.

Once all replacements have been reviewed click OK to accept the changes and apply them into the project.

Click OK to close the rule builder.

Edit Variables

To edit an existing variable contained within a rule, in the rule builder:

  1. Click on the variable within the rule to edit, so the cursor directs focus on the variable.
  2. Right click the variable to open the context sensitive menu.
  3. Click Edit Variable.
  4. A further Rule Builder will open with the rule applied to the selected variable ready for editing.

  5. Make the required changes to the rule and click OK to return to the original rule builder.