About Customization of Analyses with Scripts

Scripts called by templates offer specific functionalities that customize the analyses when templates are applied.

For more information about the creation and the deployment of scripts, see Customizing Operations with Scripting API, Template Creation and Deployment, and Deploying Modules.

On the cloud only: The use of Template Documents to store customization files is mandatory to allow the scripts to be deployed on the server. For more information, see About the Template Page.

See Also
About Analyses and Tables

Attributes available to define templates contain entry points for a few kinds of algorithms, which customize analyses as follows:

Algorithm Purpose Description
Applying formulas

Depending on the definition of a refresh mode, the script enables the completion on demand or the automatic completion of cells by evaluating its code. The mode indicates if the computed attributes can persist.

If a formula is not found or cannot be evaluated, an error notification is raised and the cell has a red background. The details of the problems are logged in the console.

For more information, see the Formula column in Behaviors or see the formula and formulaRefreshMode attributes in columns Attribute.

If the script can read the calculated effects, these effects can be used in formulas.

Initializing analyses

The script enables the initialization of analyses by evaluating its code at the analysis creation. Indeed, some causality relationships can be automatically created for each failure mode of each function of the structure or some values can be proposed when you edit a cell of an analysis.

If a template is invalid, the initializer script is not found or invalid, an error notification is raised and the details are logged in the console.

For more information, see the Initialization Script field in About the Template Page or see the initializer attribute in Template Attributes.

You can execute the initialization script later. For more information, see Rerunning the Initialization Script.

Proposing values

A script used to customize the behavior of editors. The script enables the initialization of the possible values for each column defined in the template. These possible values are provided in a customer defined format.

These values can be suggested when completing an analysis. If the template contains errors, notifications appear.

For more information, see Behaviors.

Validating rules

The script enables the validation of rules by evaluating its code. It can return warnings and errors, which are described by the following information: error code, message, suggestion, and severity.

For example:

  • code: 'Q01'
  • message: 'Severity greater than 8'
  • suggestion: 'Raise severity'
  • severity: 'W'

If a validation rule is not found or cannot be evaluated, an error notification is raised. The details are logged in the console.

If a rule is valid for a causality relationship, a appears in the Valid column for this row, otherwise a appears for a warning or an error. You can hover over to have details about the problems.

For more information, see the Validation Rules field in About the Template Page or see the validationRules attribute in Template Attributes.

If the script can read the calculated effects, these effects can be used in validation rules.

Customizing tile view display

A script used to customize the behavior of editors. The script enables the customization of the display of tiles.

For more information, see Behaviors.

Customizing Excel reports

The modules enable the customization of the Excel reports.

For more information, see the Excel Reports field in About the Template Page or see the xlsxReports attribute in Template Attributes.

Specifying editor behavior

The module customizes the behavior of the editor, for example, the customizing tile view display or the value proposals.

For more information, see Behaviors.

Limiting analysis editability

The script enables the customization of the editing status of parts of the analysis based on limitation rules. It is invoked:

  • To compute the global editing limitations at the opening of an analysis.
  • To compute the limitation of a selected cell during editing.

The limitations are organized in four levels. Their order of priority is as follows:

  • Analysis level: limit editing for the whole analysis
  • Column level: limit editing for a specific column
  • Line level: limit editing for a specific causality relationship
  • Cell level: limit editing for a specific cell

For example, if a rule is defined to limit the editability of prevention control when the severity is lower than 2, when you select 1 for the severity for a causality relationship, the prevention controls cell in this causality relationship switches to read-only mode.

For more information, see About the Template Page or see the limitFailureModesEffectsAnalysisEditability attribute in Template Attributes.