Example-2

In the following example, I am going to add the transactions to the “Project”
configured from the excel sheet. Attached is the sample excel sheet for
reference.

I have already configured a sample project on the “SmartInteract” page. The
Automation project contains server details which will be automated to generate
a web server.  Here I am using the “Add transaction” activity here to add a
value for the transaction to the queue name as “FetchData”.

The fields configured against my project are “RequestID , OS , RAM, HDD,
Applications, IP Address, Username, Password, and ValidationImage”  and
the queues configured are “FetchData & Completed”.

Steps to create the bot

1.       Create a solution for building a workflow or open an existing solution.

2.       Install the "Interact" feature from the "Manage Features" menu.

3.       Drag and drop the “Sequence” activity from the “ControlFlow” feature
to the workflow and set it as start node.

a.       Here I am using this activity to execute the set of activities in a sequential
manner.

4.       Now, placing the “GetExcelObject” activity into the sequence.

a.       It serves as a scope to automate all other activities within this. It will load the
“Excel” file that has been provided as input.

b.       Enter the “filepath” of the excel file or select the “Three dots” and choose the
“Excel File” from the system. (Attached the sample excel file).

a.       Next, place the “ReadRanges” activity from the Excel Automation feature
within the scope.

a.       We are using this activity to read the ranges from the provided “Excel”
file and extract the data to “Datatable” type as output.

b.       Enter the “Range” as “A2” as we are reading the ranges from “A1” to the
end of the data.

c.       Provide the “SheetName” as “Sheet1” as it contains the data that needs
to be read.

d.       Navigate to the properties and create a variable in the “DataTable” field as
“Table”.

e.       There are two ways to create a variable-

f.        Method 1 – Click on the "Datatable" property within the "ReadRanges" activity
and enter the variable name. In this case, we are using “Table." Then, press
"Ctrl+Q," which is a shortcut key to create a variable.

g.       Method 2 - Click on the Variables pane and enter the name " Table." Then,
in the "Variable Types" column, select "Browse for Types" from the dropdown
menu.

h.       The .Net window for data types will appear on the screen, enter the type name
as “System.Data.Datatable” and then click on “OK” button.

5.       Now, place the “ForEach” activity next to the “ReadRanges” activity.

a.       Here I am using this activity to iterate each row and extract the values from
excel to add it in the “Interact”.

b.       Choose the “TypeArgument” as “DataRow” as here we are going to iterate
from each row.

c.       Providing the value as “Table.Asenumerable”.

6.       Now, inside the body of the “ForEach” activity place the “Assign” activity.

a.       Here I am using this activity to assign the value for the “ValidationImage”
field to give the input.

b.       Providing the “To” value as “ValidationImage” and value as
“C:\Users\ \Pictures\Camera Roll”.

7.       Next, placing the “AddTransaction” activity next to the assign
activity.

a.       Using this activity, I am going to add the transactions from the values
extracted from the excel sheet.

b.       Double click on the activity.

i.      In the “Json” field, I am entering the sample “Json” string copied from
the “Interact” page. Refer the steps above on where to find the json string.

ii.      Moving to the “QueueName” field, I am mentioning the name as “Fetchdata”
where I have configured to add the transactions in the “Interact”.

c.       Now, navigating to the “AttachmentFieldName” in the properties to provide
the field name.

i.      Here, I am pasting the “AttachmentFieldName” copied from the “Interact”
as “Documents”. Refer the steps above on where to find the attachments
in Interact.

d.       Moving to the “InputParameters” to pass the input variables to
the field.

e.       Click on the three dots to open the “Arguments panel”.

i.            Here you have to manually create the Field name and pass the
variable against it.

ii.            Click on the “CreateArgument” option and providing the name as
“RequestID”.

iii.            Continuing creating Arguments for other fields as provided in example 1.

f.        Now, I am going to provide the value for the created Arguments.

i.      Click on the “RequestID” and provide the value as “Item(0).ToString”.

ii.      The “Item(0).ToString” is the value extracted from the “ForEach” activity
from the provided datatable. The “(0)” is the index position that represents
each column in the row extracted.

iii.      Next, moving to the “OS” and provide the value as “Item(1).ToString”.

iv.      Then, moving to the “RAM” and provide the value as “Item(2).ToString”.

v.      Next, moving to the “HDD” and provide the value as “Item(3).ToString”.

vi.      Next, moving to the “Applications” and provide the value as “Item(4).ToString”.

g.       Now, moving to the “BatchID” in the output properties to declare a variable
to get batch Id as return.

i.      There are two ways to create a variable-

ii.      Method 1 – Click on the "BatchID" property within the "AddTransaction" activity
and enter the variable name. In this case, we are using “BatchID." Then,
press "Ctrl+Q," which is a shortcut key to create a variable.

iii.      Method 2 - Click on the Variables pane and enter the name " BatchID." Then,
in the "Variable Types" column, select "String" from the dropdown menu.

h.       Now, moving to the “URN” in the output properties to declare a variable to get
URN value as return.

i.      There are two ways to create a variable-

ii.      Method 1 – Click on the "URN" property within the "AddTransaction" activity
and enter the variable name. In this case, we are using “BatchID." Then, press
"Ctrl+Q," which is a shortcut key to create a variable.

iii.      Method 2 - Click on the Variables pane and enter the name " URN_Value."
Then, in the "Variable Types" column, select "String" from the dropdown
menu.

8.       Now, add a “WriteLine” activity next to the “AddTransaction” activity.

a.       Providing the text as “BatchID:” +BatchID+ “URN:” +URN in the box.

b.       It will print both the “BatchID” as well as “URN” in the output window.

9.       Now, execute the bot.