Custom Scripts for the External BOM DataField

Learn about using custom scripts in the external BOM DataField property of elements to deliver better BOM reports.

You can use expressions in the DataField property to specify a custom output for the cells. All expressions used in the DataField property begin with the equals sign (=).

To add a custom script to a BOM report, select a cell and modify the DataField from the right pane of the BOM Template Editor dialog.

The text placed between /* and */ in the script is considered a comment and will be ignored.

Use a mathematical expression

Change the DataField property to the desired mathematical calculation. Before making the operations, the tokens need to be cast to an integer or double type. Without a cast, the tokens will be evaluated as strings.

Examples:

Concatenate strings

Change the DataField property for the text box to the following. Here, the tokens are automatically used as strings.

Example:

Use conditional statements

The DataField can be used with simple conditional statements in the form of:

(condition) ? (executed if condiftion is true) : (executed if condition is false)

Multiple conditions can be cascaded together.

Examples:

Other functions

The DataField can perform additional actions that are defined in C# System class.

Examples: