Create a variable
Create a variable to store values.
To create and configure a variable, perform the following steps:
From the Bot editor, click (+ icon) at the top of the Variables menu.
In the Create variable window, enter a descriptive name for the variable that is prefixed by a lowercase letter to indicate the variable type.
sCellValueto indicate a string data type.Nota:
- You can use double-byte characters, such as Chinese, Japanese, or Korean characters, in a variable name. Intervallo Unicode supportato nelle variabili
- Variables cannot be named Java keywords, such as String, Boolean, Integer, Public, and Finally.
Immetti una descrizione.
Recommendation: Provide meaningful variable description when defining input or output variables.
- Opzionale: Select the Constant (read-only) option to ensure values cannot be edited or overwritten.
Scegli tra le seguenti opzioni:
This field pertains to using a bot to run other bots. Consulta Task Bot package.
The following example illustrates when to select Use as input or Use as output in a variable.
- Usa come input: The variable holds a value that can be passed from the parent bot to a child bot. (Applicable only to a child bot)
- Usa come output: The variable holds a value that can be passed from a child bot to the parent bot. (Applicable only to a child bot)
- Both: The value can be passed in both directions.
- Neither: The variable is confined to this bot; it cannot be shared across other bots.
Suppose you want to add two numbers. The values are present in the parent bot, and the child bot performs the calculations. For the parent bot to transfer the values to the child bot, the two variables you created must be selected as Use as input so that the child bot can receive the values. Now, for the parent bot to receive the calculated value, the variable that stores the result of the calculation in the child bot has to be selected as Use as output.Nota: Ensure that you select the check boxes when you create a variable in the parent bot and the child bot. When you build the bot, and if you edit the selection of check boxes, it might impact your parent bot references, such as your parent bot might not work after this change.
Select a data type from the drop-down list.
For more information on data types, see Tipi di variabili.
Enter a default value to assign to the variable.
The values are NULL/empty by default.
Fai clic su Crea.
The variable appears in the Variables pane on the left side of the Bot editor.If you want to edit a variable, you can change its name and value but not its data type.
To insert a variable into an action field, perform one of the following actions:
You can use the variable option and pass it as a parameter to open a file in packages such as XML, Excel basic, or Excel advanced. Per aprire file con estensioni diverse, utilizza l'opzione variabile per assegnare il percorso della cartella, il nome del file e l'estensione del file. First, create a variable for the folder path,
- Click F2 to open the variables list.
- Click the Insert a value icon, located on the right side of the field.
- Enter the variable name. As you type, the field generates suggestions of existing variables.Nota: Add a dollar sign at the start and end of the variable. Ad esempio,
$sFolder$. Then, for the files in the folder path, create two variables, one for file name
$name$and another for file extension
$extension$. To open a file, combine the variables as a string, such as
$sFolder$\$name$.$extension$. Affinché l'estensione funzioni con diversi tipi di file e diverse opzioni di apertura, è possibile aggiungere una logica condizionale.