Conditional Attribute Value Metric

The Conditional Attribute Value Metric evaluates the value of a selected attribute based on an operator, and if that evaluation returns as true, then the metric will proceed and evaluate the value of another selected attribute based on an operator. The results of the evaluation (based on the selected operator for the second attribute) are either a '100' (true) or '0' (false).

Important: Metrics are used in conjunction with sufficiencies to determine the quality and completeness of a product's data. While this topic covers the functionality and configuration of the Conditional Attribute Value Metric, it is important that users are also familiar with sufficiencies and how they are combined with metrics. Information regarding sufficiencies can be found in the Sufficiency Configuration Type topic here.

Prerequisites

Before metrics can be created, a Setup Group must be configured to hold them. For information on configuring a Setup Group for metrics, refer to the Initial Setup for Metrics topic in the Metrics documentation here. For information on creating a metric, refer to the Creating and Editing Metrics topic in the Metrics documentation here.

Conditional Attribute Value Metric configuration

  1. From the Edit Metric Configuration wizard, select 'Conditional Attribute Value Metric.'

  1. With the Conditional Attribute Value Metric selected, in the 'If' section of the metric, click the ellipsis button to select the first attribute, select an operator from the operator dropdown menu, and input a value into the 'Value' text field. Repeat these actions for the parameters within the 'Then' section of the metric.

Once an operator is selected from the 'Operator' dropdown list, a default error message will appear in the 'Error Message' text field, based on the selected operator.

Operator options include:

  • Is empty
  • Is not empty
  • Equal to
  • Not equal to
  • Contains
  • Regular expression
  • Greater than
  • Less than
  • Length is equal to
  • Length is greater than
  • Length is less than

Note: If the attribute selected has a validation base type that does not allow for numbers, the 'Greater than' and 'Less than' operator options will not be available. If 'Is empty' or 'Is not empty' is selected as an operator, the Value text field will be disabled.

In the example below, in the 'If' section of the metric, the user has selected the attribute 'Hazardous Materials' for the first attribute, 'Equal to' for the operator, and input 'Yes' in the 'Value' text field. In the 'Then' section of the metric, the user has selected 'Contains Chemicals' for the second attribute, 'Contains' for the operator, and input 'Chlorine' in the 'Value' text field.

When run, this metric will first check the attribute value for 'Hazardous Materials;' if the value is equal to 'Yes,' it will then check the value for the attribute 'Contains Chemicals.' If the attribute value contains the word 'Chlorine,' a score of '100' will be returned. If the word 'Chlorine' is not present in the attribute value, it will return a score of '0' and display a message in the 'Message Preview' text field based on the 'Equal to' operator. If the first attribute 'Hazardous Materials' is not equal to 'Yes,' then the metric will not check the value for the second attribute.

Note: If the user selects an attribute that is not valid for a product, the metric will be considered non-applicable for that product and no data quality information will be produced when the Sufficiency Data Calculator event processor is run.

  1. To edit the error message and/or add additional translations, click on the Error Message editor button.

The 'Edit messages' window appears. Note that the 'Message' text field is editable. Descriptive text below the text field details how the placeholders included in the error message work in order to create an error message. Although the default error message (or something similar) is suggested, users are able to edit all or part of the error message, depending on their individual needs.

Note: Although the error message can be edited by the user, the placeholders themselves (e.g., attribute_id, attribute_value) cannot be edited. If the placeholders are edited, the user will receive a validation error message when attempting to save the edited message. When the metric is run, placeholders are replaced by the ' real values,' e.g., 'attribute_id' would be replaced with the name of the attribute that the metric is evaluating.

  1. Select the 'Translations' flipper and click the green plus sign located next to 'Add translation.'

  1. Click on the arrow located in the 'Language' dropdown menu; in the example below, the user has opened the dropdown menu and selected 'French.'

  1. Once a language is selected, edit the message to reflect the language specified for translation.

  1. Click the green plus sign to add another translation or 'OK' to close the 'Edit messages' window.
  1. Click 'Save' to close the Edit Metric Configuration wizard.

The metric is saved.

Note: The localized error messages are displayed by using locales; they are not context-dependent. For more information about locales, refer to the Localization topic in the Administrative Portal documentation here. For more information about localized messages, refer to the Localized Messages for JavaScript Business Rules topic in the Business Actions documentation here.

Once the metric is added to a sufficiency and the sufficiency is run, the results are displayed in the sufficiency panel within the Web UI. In the example below, the Conditional Attribute Value Metric (titled 'HazardWarningMetric') has been added to the sufficiency 'HazardWarningSufficiency,' and returned a score of '100' because the attribute 'Hazardous Materials' value is equal to 'Yes' and the attribute 'Contains Chemical' value is equal to 'Chlorine.' Because the returned score is '100' and not '0,' there is no accompanying error message.

Validation Errors

In certain instances, validation errors can occur as a result of the attributes selected for analysis. A validation error (accompanied by an error message) will occur if:

  • The provided value is not valid based on the selected attribute validation base type.
  • The selected attribute is multivalued.

In the example below, the user has input the word 'seven' into the 'Value' text field, but because the attribute selected for analysis has a number validation base type (identified by the highlighted '123'), the provided value must contain numbers only. Because of the incompatibility, a validation error occurs, with an error message that describes the reason for the error.

The following instances will also produce validation errors. However, these errors will not appear until the metric is run. The error message will appear in the Background Process Log of the Data Sufficiency Calculator event processor.

  • A selected attribute has a unit but the value provided by the user in the metric configuration has no unit.
  • A selected attribute has no unit but the value provided by the user in the metric configuration has a unit.
  • A selected attribute and the value provided by the user in the metric configuration have different base unit conversion rules.
  • A selected attribute's unit and/or the value's unit provided by the user in the metric configuration has no base unit conversion rule.

For more information regarding units, including base units and conversion rules, refer to the Units topic in the System Setup documentation here.