UiPath Studio Guide

Text Variables

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.

Note:

All strings in UiPath have to be placed in between quotes.

Example of Using a Text Variable

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.

  1. Create a sequence.
  2. Create two simple string variables, strFullName and strFirstLetter.
  1. Add an Input Dialog activity to the Designer panel.
  2. In the Properties panel, in the Label field, type "Type your full name please.".
  3. In the Title field, type "What is your name?".
  4. In the Result field, add the StrFullName variable. This variable stores whatever the user writes when prompted with the Input Dialog activity.
  5. Add an Assign activity under the Input Dialog one.
  6. In the Properties panel, in the To field, add the strFirstLetter variable.
  7. In the Value field, type strFullName.Substring(0,1). The strFirstLetter variable is assigned the new value created by the strFullName.Substring(0,1) expression.

Note:

This field uses the Substring() function to find the first character from the string added by the user in the Input Dialog.

  1. Add a Write Line activity under the Assign one.
  2. In the Properties panel, in the Text field, enter the strFirstLetter variable. 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.
  1. Press F5. The What is your name? window is displayed.
  2. 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.


Text Variables


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.