Altair SmartWorks Analytics

 

Merging Columns

The Merge operation is found within the Column Changes node and allows you to combine values from at least two different columns into a single column in your table. You can also perform a merge on one column with or without custom text. This operation is applicable to fields of all data types.

Prerequisites

  • An Execution Profile with an active session linked to the workflow

  • A Column Change node connected to a Data Frame node

 

Steps

  1. Configure the Column Changes node by double-clicking on the node or using the Open option provided in the node menu.

  2. The table displays.

Merging Two Columns

You can easily merge two columns following the steps described below.

Steps

  1. Select a column to merge with another column in your table, click on the Merge tab in the Column Changes menu, and then click the Merge link that displays.

  2.  

    The column you selected in Step 1 displays as the first (left-hand) column for the merge.

     

  3. You can specify a different column to serve as your first column by clicking the dropdown arrow located to the right of the selected field and then choosing a different field name from the list that displays.

  4.  

  5. Choose a second (right-hand) column to merge with the first column by clicking on the dropdown arrow of the next Add Column to Merge menu and selecting a field from the options that display.

  6.  

  7. Repeat Step 4 until all of the columns you wish to merge have been selected.

  8.  

  9. Tick the Remove Original Column box if you want the new merged column to replace the original columns.

  10.  

  11. If you wish, add a separator in the field provided to improve the presentation of your merged columns.

  12. In the example below, the columns First Name (first) and Last Name (second) will be merged. Thus, we specify a space as a separator.

     

    However, if the columns Last Name (first) and First Name (second) are to be merged, we will probably use a comma and space as a separator so that the resulting rows show a more standard form for names.

  13. Specify a name for the merged column in the field provided.

  14.  

  15. Select Apply when you are done.

  16. You can abandon the merge operation by clicking the Cancel button instead.

    The new column is added to your table, as shown below.

     

  17. To check the code that will be executed for your specified Column Changes configuration, save your specifications and then click on the Code tab of the Column Changes Node Viewer. You can also use the tab that displays to refine the code further.

  18.  

  19. To complete the Column Changes node configuration, press Save. To cancel your changes and return to the Workflow Canvas, press Discard or simply close the Column Changes Node Viewer. To execute your column changes, click the Run button.

Creating Custom Merges

Besides creating merges from two columns, you can also merge columns with custom text. In the example described below, we will merge the column Customer with custom text.

Steps

  1. Select the column to merge with custom text and then click Merge > Merge.

  2. The column you selected in Step 1 displays as the first (left-hand) column for the merge.

     

  3. Click Add a Column to Merge and then, in the Search or add custom text box, type in any text you wish. Click Add as a custom text when you are done.

  4.  

  5. Repeat Step 2 until all of the custom text you wish to merge with your selected column has been defined.

  6. If you wish, add a separator in the field provided to improve the presentation of your merged columns.

  7. Specify a name for the merged column in the field provided.

  8. Tick the Remove Original Column box if you want the new merged column to replace the original selected column.

  9. Select Apply when you are done.

  10. You can abandon the merge operation by clicking the Cancel button instead.

    The new column is added to your table, as shown below.

     

  11. To check the code that will be executed for your specified Column Changes configuration, save your specifications and then click on the Code tab of the Column Changes Node Viewer. You can also use the tab that displays to refine the code further.

  12.  

  13. To complete the Column Changes node configuration, press Save. To cancel your changes and return to the Workflow Canvas, press Discard or simply close the Column Changes Node Viewer. To execute your column changes, click the Run button.

If you wish, you can apply these same steps to merge two or more "columns" of custom text, essentially creating a new column containing custom (but identical) values in your table.