Objective

The objective of this practice problem is for the user to demonstrate an understanding of the data table commands discussed in the previous section by creating an automation that utilizes said commands. The commands covered in the previous section were the Create DataTable, Add DataRow, and Remove DataRow commands. In the future, these commands may be implemented into other practice problems.

Scenario

An employee of the ABC company needs to create a tabular data sheet consisting of data corresponding to new hires. The table must be created with the required structure containing ID, Name, Age, Title, Team, Phone, Department of the employees (User can add more employee characteristics upon choice). It must be then attached to a blank word document and saved in the system for future references.

Prerequisites

The user does not require any pre-requisites for the task. The data table would be created new and saved in a new blank word document. Both these instances can be freshly created in Openbots Studio. However, below is the snapshot of a sample excel file containing the columns required for the data table. It can be used as reference while creating the columns in Openbots Studio.

Practice Problem Requirements

The user must create an automation that performs the following tasks:

  • Creates a data table with defined column names.
  • Adds data to it using the data row command (User choice of data but the data should be meaningful)
  • Creates a Word Instance with a unique name (User may decide instance name, but it should not be the default instance name)
  • Opens a new blank document in word
  • Appends the Data table to the document
  • Removes certain rows from the data table and re-append it to the word document stating “Updated Table”
  • Save the document with a unique name in a separate folder (the user can decide which folder the file is saved to)
  • Close the word Instance once the other commands have been completed.

Problem Difficulty: Easy
Solution will be provided on the next page with a brief explanation.

Solution
The code for the solution has been provided below.

As a quick summary:

Step 1: Create Data table command will create a blank table with declared columns as per user choice. The user needs to fill in the instance name of the table and required columns it will encapsulate.

Step 2: After creating the empty table, the user needs to add data to it using the add data row command. The user needs to add each row based the formatting of the columns.

Step 3: The Create Word Application command is called because it tells the automation that it needs to work with word document. The visibility and close Instances fields can both be set to yes or otherwise.

Step 4: The Add document command specifies that a blank document is opened to the automation so that it can be used to attach data to it.

Step 5: The data table created is attached to the blank word document using the add data table command in word commands list. It will paste the data table into the word sheet.

Step 6: To update the data table and delete a record (data row) from it, the user needs to execute the remove data row command which will remove the particular data row with the matching data the user enters to delete and then append it back to the word document with a note (text) stating updated table.

Step 7: The Save document as command will allow the specified word file to be saved under a user designated name in the specified file location.

Step 8: The Close word application command will allow the word application to be closed as it is no longer needed. The Save on Close field is set to no because the file has already been saved.

Newsletter Bot

Lets stay in touch!

Join our weekly newsletter and follow us on social media.

Contact Sales
Call Our Experts!