Step-By-Step Guide to Use Assign and WriteLine Tool for Array of Variables

In this example we are printing the first name, last name and employee ID of an employee using the array of variables.

With the help of Input Dialog activity, inputs are provided at the time of running the project. The inputs are then stored in the string array of variable by Assign activity. The output is then printed on the Automation Studio console using the WriteLine activity.

 

  1. Create a new process.
  2. In the Parameter bar, create string arguments , FirstName, LastName, and EmployeeID to take the user inputs.
  3. Create an array of string variable, EmployeeDetails to store all the inputs.
  4. From the Canvas Tools panel, add an Input Dialog activity to the Flowchart designer on the Canvas. By default, Input Type is set as Text.
  5. Enter the Title.
  6. In the Results list, select the FirstName variable.
  7. Add another Input Dialog activity below the first activity.
  8. Enter the Title.
  9. In the Results list, select the LastName variable.
  10. Add one more Input Dialog activity below the second activity.
  11. Enter the Title.
  12. In the Results list, select the EmployeeID variable.
  13. Add an Assign activity below the last Input Dialog activity.
  14. In the To field, enter EmployeeDetails variable.
  15. In the Value field, enter {FirstName,LastName,EmployeeID} to store all the value in the string of array variable, EmployeeDetails.
  16. Add a WriteLine activity below the Assign activity.
  17. In the Text field, enter EmployeeDetails(0)+" "+ EmployeeDetails(1)+" "+EmployeeDetails(2). The first value stored in the array is indexed at 0. The process execution fails in case out of bounds value is provided, for example EmployeeDetails(3) or further indices.
  18. Set up the environment and then click Test Run to run the project.

 


The first name, last name and the employee ID of the employee whose details you entered while running the project, is displayed in the console of the automation Studio.