studio
2021.10
false
UiPath logo, featuring letters U and I in white
OUT OF SUPPORT
Studio User Guide
Last updated Nov 18, 2024

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, FullName and FirstLetter.


  3. Add an Input Dialog activity to the Designer panel.
  4. In the Properties panel, in the Label field, type "Type your full name please.".
  5. In the Title field, type "What is your name?".
  6. In the Result field, add the FullName variable. This variable stores whatever the user writes when prompted with the Input Dialog activity.
  7. Add an Assign activity under the Input Dialog one.
  8. In the Properties panel, in the To field, add the FirstLetter variable.
  9. In the Value field, type FullName.Substring(0,1). The FirstLetter variable is assigned the new value created by the FullName.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.
  10. Add a Write Line activity under the Assign one.
  11. In the Properties panel, in the Text field, enter the FirstLetter 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.


  12. Press F5. The What is your name? window is displayed.
  13. 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.


Was this page helpful?

Get The Help You Need
Learning RPA - Automation Courses
UiPath Community Forum
Uipath Logo White
Trust and Security
© 2005-2024 UiPath. All rights reserved.