A text or string variable is a type of variable that can store only strings. These types of variables can be used to store any information such as employee names, usernames or any other string.
All strings in UiPath have to be placed in between quotes.
To exemplify how you can work with text variables, we are going to create a project that asks for the user’s name, stores it and displays only the first letter of his name in the Output panel.
- Create a sequence.
- Create two simple string variables,
- Add an Input Dialog activity to the Designer panel.
- In the Input Label field, type "Type your full name please.".
- In the Dialog Title field, type "What is your name?".
- In the Value entered field, add the
FullNamevariable. This variable stores whatever the user writes when prompted with the Input Dialog activity.
- Add an Assign activity under the Input Dialog one.
- In the Properties panel, in the To field, add the
- In the Value field, type
FirstLettervariable is assigned the new value created by the
This field uses the
Substring()function to find the first character from the string added by the user in the Input Dialog.
- Add a Write Line activity under the Assign one.
- In the Properties panel, in the Text field, enter the
FirstLettervariable. This means that the Output panel is going to display the first letter of what the user wrote in the Input Dialog. The project should look as in the following screenshot.
- Press F5. The What is your name? window is displayed.
- Type your name in the text field and click OK. In UiPath Studio, in the Output panel, note that the first letter of your name is displayed.
Updated 3 months ago