Parameterize scripts
Parameterizing a script is to replace constant values in the script with parameters. This allows you to re-use steps and create more flexible scripts.
Overview
You can use input parameters to parameterize step input values and AI object names. You can use output parameters to store step output values.
A parameter is a variable that is assigned a value. FT Design supports only String type parameter values.
The following sections describe how to create and use parameters:
Create and manage parameters
In the Script parameters pane, you can create an input or output parameter, edit the default value of an input parameter, or delete a parameter.
You can create all required parameters in advance in the Script parameters pane, and then add them to steps, or you can create parameters when you need them in a step.
To create an input or output parameter:
-
In the upper right corner, click the @ icon.
The Script parameters pane opens.
-
Click + Create new.
The Add New Input/Output Parameter dialog box opens
-
Enter an unique parameter name. For input parameters, define a default value.
When you name a parameter, consider the following restrictions:
-
Case-sensitive
-
Must begin with a letter
-
Cannot contain spaces
-
Cannot contain the following characters: ! @ # $ % ^ & * ( ) + = [ ] \ { } | ; ' : " , . / < >
-
To manage parameters:
-
To edit an input or output parameter, select an input or output parameter and click the Edit
icon to modify the parameter name or value.
When you change the name of a parameter, the parameter name in all the step lines that use this parameter is changed accordingly.
-
To delete an input or output parameter, select a parameter and click the Delete
icon.
If the parameter is used by your script, after it is deleted, the step lines that reference the parameter are marked as invalid.
-
To use an input or output parameter in your script, see Use parameters in the Editor and Use parameters in the step editing pane.
Use parameters in the Editor
While you are editing a script, you can directly use input parameters to pass values into your steps or save values into output parameters in the Editor.
-
Open a codeless automation script.
-
Select a step in which to add an input parameter.
-
Hover over the value or object name and click the drop down arrow.
-
In the pop-up window, select an input parameter you created before. If you haven't defined any parameter, click + New Parameter to create a new input parameter.
The constant value in the step is automatically changed to the added parameter.
-
To convert back to the original constant value, hover over the parameter and move the Use Input Parameter switch to off state.
Note: When you type @ in the step line, a pop-up window opens for you to create or select an input parameter.
To save a value in an output parameter:
You can pass a constant value, the value of an input parameter, or the value of an AI object into an output parameter.
To pass... | Type... |
---|---|
a constant value |
|
the value of an input parameter |
|
the value of an AI object |
Type one of the following syntax:
|
When you type @ in the step line, a pop-up window opens for you to create or select an output parameter, as shown below:
Use parameters in the step editing pane
When editing a step in the step editing pane, you can select whether to use a constant value or an input parameter as the object name or the step value.
-
Open a codeless automation script.
-
Select a step in which to add an input parameter.
-
In the step editing pane, click the
icon next to the Text identification or Value input box.
-
In the pop-up window, select an input parameter you created before. If you haven't defined any parameter, click + New Parameter to create a new input parameter.
The parameter is automatically added to the Value input box and the step.
-
To convert back to the original constant value, click the
icon again and move the Use Input Parameter switch to off state.
To save the step result in an output parameter:
In the step editing pane, you can save the result of a conditional step or a verification step in an output parameter. For details, see Add conditional steps and Add verification steps.
See also: