Spectre Build Calc Object
The Spectre Build Calc object allows you to apply operations to the data before building the cBase. The add and replace operations allow for versatility by using Spectre expressions.
The calc object properties panel has five sections where you set attributes.
You define operations on the data columns in the Operations table. A column count is included in the header.
Operations are how column values are evaluated in a calc object. You can add a new column to your tables by using the add operation functionality. By defining a column name and an expression, you control what values go in a column of your design.
-
On the Operations pane, click the Add Add Operation icon.
A new operation row appears.
-
Click the operation row to edit the Spectre expression for the operation in the Expression pane.
-
Double-click the Operation name to rename the new column.
The column value is set to the calculated value when the calculation object runs.
There are two ways to insert a replace operation:
-
Click the Add Replace Operation icon.
A new operation row appears with the name "ReplacedColumn". Change that name to the name of the column you want to replace.
-
Double-click the name of the column you want to replace in the Available Columns table.
A new operation row appears with the name of the column you double-clicked.
You can edit the Spectre expression for the operation in the Expression pane.
The column value is replaced with the calculated value when the calculation object runs.
You can remove unnecessary or unwanted operations with the remove operation functionality. This functionality does not delete columns, it only removes any operations that affect existing columns or delete columns being added through operations.
-
In the Operations pane, click the row for the operation you want to remove.
-
Click the Remove Operation icon.
For each operation selected, the Expression Editor allows you to enter Spectre expressions that run when the calculation object runs. The Function List provides a list of all available Spectre functions.
To insert a function into the Expression Editor directly from the Function List, click on the area in the Expression Editor where you want to insert a function, then double-click a function in the Function List. The function populates in the Expression Editor.
TIP: To view parameters and a summary of a function, highlight it in the Expression Editor and details of that function appear in the Documentation tab of the Comments pane.
With a row in the Operations table selected, additional properties can be set in the Operations Properties panel.
NOTE: See Text, cBase, and Dive Input Build Tags to view the full assortment of properties that can be used as tags in a Spectre Build script.
Attribute | Description |
---|---|
Duration | If set to true, the column must be a numeric column, and it will be marked as a duration column. Duration columns behave the same as normal numeric columns, except that they are meant to be displayed differently. When duration columns are displayed they ignore any format string and display as h:mm:ss (the value is interpreted as seconds). |
Format |
Sets the display format. Use to format dates, periods, currency, and Boolean expressions. Setting the format
|
Label |
Defines the display label used for a column. |
Required Dimension |
Sets a column to behave like a classic Info Field. In ProDiver, the info field is available as a column that you can add to other columns displayed in a dive. For example, to see Address requires that Customer is available. Setting required dimensions
The first column is only available when the second column is displayed in the client.
|
Sort By |
Specifies an alternate sort. When specifying columns, use sort-by to order them based on another column's value. Setting sort by
The alternate sort is set. NOTE
|
Sort Natural |
Disables natural string sorting in text-input. The default is true—Spectre interprets value of digits as decimal numbers and sorts according to the numeric values in the string. TIP: This feature only makes sense together with sort-by if the sort-by column is also a string column. |
Suggested Dimension |
Allows you to promote (true) or demote (false) a column. NOTE
|
Summary Type |
Sets the column's summary type explicitly. Any summary function that takes a single argument (except for count and percentile) are allowed. Most common are sum, info, any, first, last and const. The default for numeric data is sum; use kahan_sum if concerned about precision; use const for a column with only one value. The rest of the functions (for example, min, average, median) are better done as a separate calc (that is, not the default one).
|
Each object has an area where you can enter comments for documentation purposes. Each row in the Operations table has a separate comment section.
It is a DI best practice to enter a note for every object in a Spectre Build script.