Altair SmartWorks Analytics

 

Extracting Columns

The Extract operation is found within the Column Changes node and allows you to extract strings from a specific column in your table. You can extract strings using position and length or specific characters. This operation is only applicable to text fields.

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 in the Node Viewer.

  3. In the Configuration tab, select the column you wish to extract strings from and then click on the Extract tab in the Column Changes menu.

Extracting Strings Using Position and Length

Steps

  1. To extract strings by using position length, click on the Using Position and Length option.

  2.  

  3. Provide a position number in the field from which extraction should begin and a length of string to extract.

  4. Tick the Position from End of the String box if counting for the position number should begin at the end (right-most side) of the string.

  5. In the example below, we will extract the zip code from a column containing addresses. All of the zip codes are 5-digit strings found at the end of the field. Thus, we specify a position of 1, length of 5, and tick the Position from End of the String box.

     

  6. If you wish to create a new column for the extracted string, tick the Create New Column box and provide a column name.

  7.  

  8. If you wish to apply the extract operation to multiple columns, click on the Apply to multiple columns link and then choose which columns to apply the same operation to. Click Apply when you are done to save your selection(s). This option is disabled if you choose to create a new column in which to display the extracted string in Step 4.

  9.  

  10. Select Apply when you are done.

  11. You can abandon the extract operation by clicking the Cancel button instead.

    If you chose to create a new column, the new column is added to your table, as in the example below.

     

    If you did not choose to create a new column, the field values in the original column are updated.

  12. 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.

  13.  

  14. 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.

Extracting Strings Using Specified Characters

Steps

  1. To extract strings using specific characters instead, select the column you wish to extract strings from and then click on the Specified Characters option in the Extract tab.

  2. Provide specific start and end characters to mark the beginning and end of the string to extract.

  3. When specifying start and end characters:

    • If you do not define a start character, the application extracts all possible characters up to the defined end character.

    • If you do not define an end character, the application extracts all possible characters beginning from the specific start character.

    • If you do not define both start and end characters, all of the contents of the field are returned.

    In the example below, we will extract user IDs from email addresses. Each email address includes the @ sign. Thus, we can set a blank start character and @ as the end character. This definition instructs the application to capture all possible characters from the left-most side of the string and end when @ is encountered.

     

  4. Tick the box for Ignore case if you wish the application to ignore case when looking for specified start and end characters.

  5. If you wish to create a new column for the extracted string, tick the Create New Column box and provide a column name.

  6.  

  7. If you wish to apply the extract operation to multiple columns, click on the Apply to multiple columns link and then choose which columns to apply the same operation to. Click Apply when you are done to save your selection(s). This option is disabled if you choose to create a new column in which to display the extracted string.

  8.  

  9. Select Apply when you are done.

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

    If you chose to create a new column, the new column is added to your table, as shown below.

     

    If you did not choose to create a new column, the field values in the original column are updated.

  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.