Altair SmartWorks Analytics

 

Adding Columns

The Add Column operation is found within the Column Changes node and allows you to add a new column to your table containing either a constant value or a record number. 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 in the Node Viewer.

     

  3. In the Configuration tab, ensure that the Add Column item is selected in the Column Changes menu.

Adding a Column with a Constant Value

Steps

  1. Choose Constant Value from the Add Column options.

  2. Provide a new column name, data type, and constant value for the column to be created.

  3.  

  4. Select Apply when you are done.

  5.  

    You can abandon the Add Column operation by clicking the Cancel button instead.

    The new column is added to your table.

     

     

Adding a Column Containing Record Numbers

Steps

  1. Select Add Record Number from the Add Column options that display.

  2. Provide a name for the column to be added to your table and then click Apply.

  3.  

    You can abandon the Add Column operation by clicking the Cancel button instead.

    The added column displays.

     

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

  5.  

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

Adding a Column Containing a Calculated Field

Steps:

  1. Select a field in your table to use as a basis for your calculated field.

  2. Select Add Calculated Fields from the Add Column options.

    The Formula window displays.

     

  3. Enter a new column name into the Column Name field. By default, this field is prepopulated with the name of the field you selected plus a numeral indicating that this field is a copy of the field you selected.

  4. Enter a calculation formula into the Formula field. In the present example, let's say you wish to determine what your new sales totals would look like if you applied a 12% discount for all customers. In this case, you would enter the expression "[Amount]*0.88" into this field. Note that column names are case-sensitive and should be enclosed in square brackets. If the operation you indicated is correctly built, the message "Valid expression" displays above the expression builder. The Apply button at the bottom of the window is also activated.

  5.  

    If, however, the expression you built is incorrect, an error message (e.g., "Invalid right operand passed") displays instead and the Apply button is not activated. You can hover your mouse over this error message to obtain a description of what the error is so that you can refine your expression further.

     

    SmartWorks Analytics provides a sizable number of preconfigured functions that you can use to add calculated fields to your table via the Function Browser.

     

    A description of each function and an example expression are provided below the function selector to guide you as you create your calculated field.

    You can search for a specific function by typing its first few letters into the Search bar of the Function Browser.

     

    You can also place your cursor in the expression builder and press CTRL + SPACE on your keyboard. Doing so brings up a function/column shortcut menu from which you can select functions and columns to build your expression.

     

    The available functions are listed at the top of the menu, while the columns to which these functions can be applied are listed at the bottom.

     

    The table below describes the functions supported in the current release of SmartWorks Analytics.

    Function Group

    Available Functions

    DateTime

    • CurrentDate

    • CurrentDateTime

    • Day

    • Hour

    • Minute

    • Month

    • Quarter

    • Second

    • Year

    Math

    • Max

    • Absolute

    • Ln

    • Log

    • Log10

    • Negative

    • Power

    • SquareRoot

    • Exp

    • Random

    • Round

    String

    • CharLength

    • LeftTrim

    • RightTrim

    • Right

    • Left

    • Substring

    Aggregation

    • ColumnAverage

    • ColumnCount

    • ColumnMax

    • ColumnMin

    • ColumnSum

    • ColumnMean

    • ColumnMedian

    • ColumnStdDev

    Operator

    • + (Addition)

    • - (Substraction)

    • * (Multiplication)

    • / (Division)

    • % (Modulo)

    • > (Greater than)

    • < (Less than)

    • >= (Greater than or equal to)

    • <= (Less than or equal to)

    • == (Equal)

    • <> (Not equal)

    • ^ (Power)

    • - (Unary minus)

    Logical

    • And

    • Or

    • Not

    • In

    • Not in

     

    Selecting one of the functions in the function browser by double-clicking on it updates the expression builder with your selection. You can then continue to build your expression as necessary.

     

  6. Click Apply when you have finished building your expression.

  7. The new calculated field is added to your table.

     

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

  9.  

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