Using DataTable Variables
DataTable is a variable type representing tabular data as an in-memory, tabular cache, or spreadsheet of rows, columns, and constraints.Refer to Microsoft documentation for more details.
Adding new variable of type DataTable
Creating new instance
Note:
- This variable is mainly helpful during the migration of data from one database/Excel to another database/Excel.
- Following activities can be used in DataTable add/delete rows/columns Add Data Column, Add Data Row, Clear DataTable, For Each Row, Remove Data Column, Remove Data Row
Let us understand the DataTable variable with an example process. This example takes user info (First, last, and age) as input and stores the data in DataTable, finally writes to Excel Spreadsheet.
Come, let's create this process in Process Designer:
Step#1
Launch and create a new process in Process Designer
- Launch Process Designer from the Windows Start menu located under IntelliBuddies Enterprise
Step#2
Create New Process
-
Click on New Process and fill in the new process details
Step#3
-
Add variables to hold the input in the DataTable variable.
-
The following list of variables is used to hold different data.
Step#4
In Activity panel search for Add Data Column and add inside body of the For Each.
Step#5
In Activity panel search for Input Dialog
-
Drag and drop Input Dialog activity into body of For Each.
-
Takes the input and sets to dataRow
Step#6
- Add Excel activites Open Spreadsheer, Open Spreadsheer and Close Spreadsheer
- Copy blank Excel file with name outputFile.xlsx to project location.
Step#7
Save the process
- From the Design tab ribbon, click on Save
Step#8
Run the process
- From the Design tab ribbon, click on Run
Step#9
Make sure the process executes and pops up an input dialog. Enter the First and Last Name and then age as input through the input dialog. Click on Ok. Once the execution is completed, open the outputFile.xlsx where the input user details are stored in an Excel Spreadsheet. Note: The Excel data is overwritten on repeated execution.
Excel file filled with user info
Download Example (C#)