This activity assists the user in merging "Two datatables" with similar data structures
into a single table.
Technical reference
INPUT |
MissingSchemaAction: This indicates the "Action" to take when merging the "datatables." Choose an option from the dropdown:
Add: This merges all details from both tables, regardless of the number of columns present. Error: This merges details from both tables, but if an error is encountered in either table, it raises an exception. Ignore: This merge only the common data available in both "datatables," ignoring any non-common details. Addwithkey: This merges the tables according to the validated "Primary key." If a row contains identical values in both tables, this schema action will ignore the row to prevent duplicates. If the rows are not common between both tables, the entire "Source datatable" will be added to the "Destination datatable." |
|
Table1: Indicates the "Source datatable." Enter the variable for the "Input datatable" where the input data is stored. This parameter allows you to merge with "datatable2." This field exclusively accepts the "datatable" data type. |
||
Table2: Indicates the "Destination datatable." Enter the variable for the "Input datatable" where the input data is stored. This parameter allows you to merge with "datatable1." This field exclusively accepts the "datatable" data type. |
||
MISC |
DisplayName: Displays the name of the activity. The activity name also be customized to help in troubleshooting. |
|
SkipOnError: It specifies whether to continue executing the workflow even if it throws an error. This supports only Boolean value “True or False”. By default, it is set to “False.” True: Continues the workflow to the next step None: If the option is specified as blank, by default the activity will perform as “False” action. |
||
Version: It specifies the version of the Datatable automation feature in use |
||
OUTPUT |
Table: It helps to view the output of the activity as the “Merged” table in a “Datatable” datatype. (Refer the steps below to create a variable). |
* Represents mandatory fields to execute the workflow.
Here's an example of how the MergeTable activity works –
In the following example, I am using the input values from the two “Excel Sheets”
utilized to demonstrate in the Use case. To get a better understanding, click here.
(Refer the attached sample excel sheets in the use case).
1. Drag and drop the " MergeTable " activity onto the designer pane.
a. This activity can only be utilized after the other “Datatable activities.”
b. It helps to merge two tables with similar data structure.
c. Here I am extracting the output as “Datatable” from the “Excel sheet” using the
“ReadRanges” activity from the “Excel Automation.”
(Refer the Use case to get detailed information).
i. “Employee_record” is the output for the “datatable” from the first “Excel Sheet”
which is declared here.
ii. “Employee_record2” is the output for the “datatable” from the second “Excel
Sheet” which is declared here.
d. Double-clicking on the activity to provide the “Source” and “Destination”
datatables.
i. Here I am specifying the “Table1” as “Employee_record” which is the input to
“Source” datatable.
ii. And “Table2” as “Employee_record2” which is the input to “Destination” datatable.
e. Navigating to the “MissingSchemaAction” in the properties of “MergeTable” activity
to choose the schema action to be performed while merging the tables.
i. Here I am choosing the “MissingSchemaAction” as “Ignore” to ignore and remove
the similar “columns” while merging the tables.
(Refer the attached excel sheet in the use case)
f. Moving to the “Table” from the output property to declare a variable to view the
merged table.
i. There are two ways to create a variable-
ii. Method 1 – Click on the "Table" property within the "MergeTable" activity
and enter the variable name. In this case, we are using " MergeDT." 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 "MergeDT"
Then, in the "Variable Types" column, select "Browse for Types" from the
dropdown menu.
iv. 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.
g. Now, I have executed the workflow to merge the two datatables.
h. The output of the activity will be merged as one destination table. Here the
“Table2” will be destination table where the “Table1” will be merged along with it.
i. You can add “Table Viewer” activity to view the output of the merged table.
(Refer the Table Viewer activity to get detailed information)
j. Here I am using the Table viewer activity to view the “MergedTable”
output.
(Below is the sample of the “Merged Table” output)