Replacing Parameters with Arguments

When designing a command that uses a procedure with a parameter, you can replace that parameter with an argument in the Parameter Replacement Edit Box in the bottom right pane of Commands View. The Parameter Replacement Edit Box shows the procedure and parameters assigned to the selected command. To replace a parameter with an argument, select the parameter and type the change.

For example, suppose you want to create a command for the following Driver I/O table, which sets a Digital Multimeter voltage measurement to DC if the iFunct parameter is 1, or to AC if it is 2.

You can replace the parameter with a command argument that is a variable, constant, or literal.

Using a Variable as the Command Argument

The following Command Object Tree view shows a command that uses a variable, iFunction, as a argument. (For more information on this view, see Commands View.)

.

Although this example allows maximum flexibility, it requires that the user remember numbers to choose a measurement function. This could present a problem if several numbers and functions are available.

Using a Constant as the Command Argument

The following example shows a command that uses a constant, VDC, as an argument.

The advantage of this method over the previous one is that the user need only remember that the constant VDC sets the voltage DC measurement function. However, before using this command, the user still needs to set the constant to 1. This method also lacks the flexibility of using variables as parameters.

Using a Literal as the Command Argument

The following example shows a command that uses a literal, 1, as an argument and a new command item to distinguish that literal from others.

This method's advantage over the previous one is that the user sees both a command item (VDC) and number (1) to set the voltage DC measurement function. However, this method lacks the flexibility of using variables as parameters.

Combining Different Methods

You can give users the best choices by combining methods. The following example offers choices between using a variable or literals as command arguments.

When users require the flexibility of specifying their own variable, they can use the Set Function (iFunction) command. If they prefer not to specify a variable, they can use Set Function VDC or Set Function VAC.

For more information on parameters in procedures, see Declaring Procedure Variables.