Exercise - Text actions
In this exercise, you develop a flow that prompts the user for their first name and family name. The flow then generates a username by using the first letter of the user’s first name, appended to their family name in lowercase. Then, the system randomly generates a temporary password and displays the output to the user.
Tasks
For this exercise, you create a flow that will:
Prompt a user to enter their first name and family name.
Split the two names into separate strings of text.
Shift the two strings to lowercase.
Get the first letter of the first name.
Generate a password randomly.
Display a message with the username and password.
Steps
Add a Display input dialog action.
Set the Input dialog title property to Name Input and the Input dialog message property to Please enter your first and last name (for example, Adele Vance). This action displays a message that prompts the user for input.
Add a Split text action to split the first name and family name into two separate strings of text. In the Text to split field, enter %UserInput%.
Add a Change text case action.
In the Text to convert field, enter %TextList[0]%.
With the index of a list type variable, provide the first item of the list, which is the first name. Set the Convert to property to lowercase.
Add another Change text case action. This time set the Text to convert property to %TextList[1]%, thus referencing the family name.
Set the Convert to property to lowercase again.
The output is stored in a different variable than the previous Change text case action.
Add a Get subtext action to get the first character of the first name.
In the Original text field, enter %TextWithNewCase% (the variable where the first name in lowercase is stored).
In the Start index section, set Character position to 0.
In the Length section, set Number of chars to 1. This setting gets the first character of the text string.
To generate a random password, add a Create random text action. The action’s properties can be left at their default values.
Add a Display message action, which displays a message box with the new username and password. In the Message box title field, enter Username & Password, and in the Message to display field, enter the following content:
Hello, %UserInput%, your username is: %SubText%%TextWithNewCase2% Your temporary password is: %RandomText%
The username (first letter of first name, combined with family name) is displayed and the result of the Generate random text action shows as the user’s password.
The completed flow should look like the following figure.