Evaluated columns

Evaluated columns are special columns, of which results are depending on other columns using user-defined expressions. 2 types of evaluated columns are supported: formula and template columns.

Formula columns

A Bill of Materials supports formula fields. The same syntax is used in the DATAEXTRACTION command. FormulaExpression is the expression in the format of \AcExpr formula fields. This can contain constants such as PI or functions such as SIN. An operand in an expression can be a ColumnTitle enclosed in arrow brackets (<>).

For example, formula =<Mass>/<Volume> calculates the average density of the component.

If a row does not contain a value, a default value will be used instead. It is possible to specify the default value for an operand using the following syntax: <"ColumnTitle",DefaultValue> where ColumnTitle is the title of the required column, and DefaultValue is the default value. ColumnTitle must be between double quotes ("). If no default value is specified, an empty value is used, which in most cases results in an empty output.

A formula column can contain multiple expressions. Each expression must be enclosed by sum brackets ({}). These expressions are evaluated from first to last, and the first one yielding a non-empty output is used.

A formula can refer to other formula columns, provided that they do not form a loop. In a hierarchical BOM, a formula can also refer to values of the parent row by adding Parent: before the column name. It also can refer to properties that are not explicitly added to the table, but all other formula columns referred to in the formula must exist in the table. You can still use such columns displayed as invisible in the BOM table in formula expressions.

For distance, area, volume and mass properties, the values will be converted to the user-defined unit before using them in the formula expression. If the user-defined unit is not set, the document unit is used. For the mass property, kilogram is used in metric documents and lbs (pound) in imperial documents.

Template columns

Template columns allow you to combine several properties, as well as a custom text, into a single column. A special syntax, based on Diesel expressions, is used to define template columns. Expressions for template columns must start with the $ sign. An operand in an expression can be a ColumnTitle enclosed in arrow brackets (<>). It is also possible to use special functions:

Function Description
$(+, arg1, arg2[, ... , arg9]) Add the provided arguments to the first one.
$(-, arg1, arg2[, ... , arg9]) Subtract the provided arguments from the first one.
$(*, arg1 , arg2[, ... , arg9]) Multiply the first argument by the provided arguments.
$(/, arg1, arg2[, ..., arg9]) Divides the first argument by the provided arguments.
$(=, arg1, arg2) Return 1 if arg1 is equal to arg2; otherwise, return 0. Both arg1 and arg2 must be numbers.
$(<, arg1, arg2) Return 1 if arg1 is less than arg2; otherwise, return 0. Both arg1 and arg2 must be numbers.
$(>, arg1, arg2) Return 1 if arg1 is greater than arg2; otherwise, return 0. Both arg1 and arg2 must be numbers.
$(!=, arg1, arg2) Return 1 if arg1 is not equal to arg2; otherwise, return 0. Both arg1 and arg2 must be numbers.
$(<=, arg1, arg2) Return 1 if arg1 is less than or equal to arg2; otherwise, return 0. Both arg1 and arg2 must be numbers.
$(>=, arg1, arg2) Return 1 if arg1 is greater than or equal to arg2; otherwise, return 0. Both arg1 and arg2 must be numbers.
$(and, arg1, arg2[, ... , arg9]) Apply bitwise AND operation to arguments.
$(angtos, angle[, mode, precision]) Convert the angle to string with respect to given mode (0 - degrees, 1 - d/m/s, 2 - grads, 3 - radians) and precision.
$(delim, delimiter_string) Insert a smart delimiter. The delimiter string is added to the output only if the output before and after this delimiter is not empty.
$(edtime, time, format) Format the date according to the given format string.
$(eq, arg1, arg2) Return 1 if arg1 is equal to arg2; otherwise, return 0. Both arg1 and arg2 must be text.
$(eval, expression) Evaluate the given expression as a Diesel expression.
$(fix, value) Truncate the real value to the integer one.
$(getvar, variable) Return the value of the given system variable.
$(if, arg, then[, else]) Return 'then' if 'arg' is not 0; otherwise, return 'else' or empty string if 'else' is not provided.
$(index, position, comma_separated_string) Return the substring at the given position in the given comma-separated string.
$(nth, position, arg1[, arg2, ... , arg9]) Return the argument at the given position.
$(or, arg1, arg2[, ..., arg9]) Apply bitwise OR operation to arguments.
$(rtos, value[, mode, precision]) Format the given value with respect to the required mode and precision.
$(strlen, string) Return the length of the given string.
$(substr, string, start[, length]) Return the substring of the 'string' from 'start' of the given 'length'. Numeration starts from 1.
$(upper, string) Convert 'string' to uppercase.
$(xor, arg1, arg2[, ... , arg9]) Apply bitwise XOR to all arguments.

One template column can contain multiple expressions. Each expression must be enclosed by sum brackets ({}). These expressions are evaluated from first to last, and the first one yielding a non-empty output is used.

A template column can refer to other evaluated columns, provided that they do not form a loop. In a hierarchical BOM, a template column can also refer to values in the parent row by adding Parent: before the column name. It can also refer to properties that are not explicitly added to the table, but all other evaluated columns referred to in any of the expressions must be present in the table. You can still use columns displayed as invisible in the BOM table in template expressions.

You can use "\n" string to add a line break.

For example, the following expression combines PartNumber, Width, Height and Length properties:

${<PartNumber>$(delim," X ")<Width>$(delim," X ")<Height>$(delim," X ")<Lenght>}

Expression configurator

You can use the Expression configurator to configure an evaluated column. This dialog box is available in Bill of Materials Manager.

This dialog box allows you to set the title and unit for the column, edit the expression using an editor with syntax highlight and autocompletion, and see a preview of the BOM table with the evaluated column. For a template column, the Template section allows you to easily insert, move and delete properties, as well as delimiters and custom texts.