Exercise - Use message boxes to communicate

Completed

In attended automation, the interaction between users and workstations is essential. Message boxes provide a direct means for this communication to take place.

In this exercise, you develop an attended flow that reads orders from Excel worksheets and prompts users to select a discount for high-value orders.

To begin, download Orders.zip. Select Download on the right and extract the Excel file to your local computer.

  1. Start by prompting the user to select an Excel file. Use the Display select file dialog action and configure the File filter field to allow only xlsx files.

    Screenshot of the Display select file dialog action.

  2. Before reading any data from the selected file, you have to launch it using the Launch Excel action.

    Screenshot of the Launch Excel action.

  3. To read the data from the Excel file, deploy the Read from Excel worksheet action and select All available values from worksheet in the Retrieve field.

  4. Open the Advanced properties and turn on First line of range contains column names.

    Screenshot of the Read from Excel worksheet action.

  5. Deploy the Get first free column/row from Excel worksheet action to retrieve the first free column and row in the Excel worksheet.

    Screenshot of the Get first free column row from Excel worksheet action.

  6. Use the Write to Excel worksheet action to add a Discount header in the first free column of the Excel file.

    Screenshot of the Write to Excel worksheet action that writes the Discount header.

  7. Before handling each Excel row independently, create a new variable named Counter and initialize it to 2. This variable indicates the number of the row you're handling in each iteration.

    Screenshot of the Set variable action.

  8. Add a For each loop to iterate through the retrieved data.

    Screenshot of the For each properties dialog.

  9. To check the value of the Gross column (column G or the sixth column in the worksheet), convert it into a number, and then add an If action to check whether it exceeds 100,000.

    Screenshot of the Convert text to number action.

    Screenshot of the exercise workspace with the if block added.

  10. If the value exceeds 100,000, the user should decide whether to add a discount. Deploy the Display message action to provide the necessary information to the user, and prompt them to choose Yes or No.

    Screenshot of the Display message action.

  11. Add a second If action to check which button was pressed in the previous step.

    Screenshot of the If action.

  12. If the user selects Yes, a window prompts them to enter the discount amount; use the Display input dialog action to achieve this functionality.

    Screenshot of the Display input dialog action.

  13. Write the selected discount amount into the Discount column of the Excel file.

    Screenshot of the Write to Excel worksheet action.

  14. Before exiting the previously created For each loop, use the Increase variable action to increase the Counter variable by one.

    Screenshot of the Increase variable action.

  15. Finally, run the flow. When prompted, select the Orders.xlsx file.

    Screenshot of the completed exercise workspace.