defaultValue Annotation

The defaultValue annotation is used on a variable to define the value it should start with when configuration begins.

AnnotationdefaultValue
Applicable toVariable
Value Type/ValuesLiteral
DescriptionThe configurator uses the default value defined in PCM (Product Attribute Definition). If no PCM default is available, the configurator uses the first value in the variable domain as the initial value. If no default value is defined in PCM and a defaultValue is specified in CML, the configurator uses the value defined in CML as the initial value of the variable. When you create or update an attribute by calling Product Configurator API while a constraint model is active, include AttributeName in the payload and set it to the attribute’s developer name. The constraint engine matches that value to the CML variable name. If the payload omits AttributeName, the engine applies the default described in this topic instead of the submitted value. See Configurator API: Include the Attribute Developer Name When Creating or Updating Attributes.

Example 1 

In this example, neither PCM nor CML defines a default value for the Cable Entry variable.

1type GeneratorSet {
2    relation voltageConnections : VoltageConnection[1..999999];
3}
4type VoltageConnection {
5    string cableEntry = ["Top Entry", "Bottom Entry", "Side Entry"];
6}

Example Description and Configurator Result 

The configurator sets "Top Entry" as the initial value for Cable Entry, because it is the first value in the variable domain ["Top Entry", "Bottom Entry", "Side Entry".

Example 2 

In this example, PCM (Product Attribute Definition) defines "Bottom Entry" as the default value for Cable Entry, and no defaultValue annotation is defined for this variable in CML.

1type GeneratorSet {
2    relation voltageConnections : VoltageConnection[1..999999];
3}
4// This annotation is added automatically if PCM has a default before the product is added to CML. If the product already exists in CML, the annotation is added or updated only after running Sync.
5@(defaultValue = "Bottom Entry") 
6type VoltageConnection {
7    string cableEntry = ["Top Entry", "Bottom Entry", "Side Entry"];
8}

Example Description and Configurator Result 

The configurator sets the "Bottom Entry" as the initial value for the Cable Entry of the VoltageConnection child products.

As a best practice, define the default value in PCM and use the Sync function in CML to keep the model aligned whenever PCM settings are updated.

Example 3 

In this example, a defaultValue annotation with "Side Entry" is defined in CML, and no default value is defined in PCM for the Cable Entry variable.

1type GeneratorSet {
2    relation voltageConnections : VoltageConnection[1..999999];
3}
4
5type VoltageConnection {
6    @(defaultValue = "Side Entry")
7    string cableEntry = ["Top Entry", "Bottom Entry", "Side Entry"];
8}

Example Description and Configurator Result 

The configurator sets the "Side Entry" annotation value as the initial value for Cable Entry.

We recommend that you define default values in PCM (Product Attribute Definition) whenever possible, as this approach promotes consistency across products and simplifies maintenance.

Note

The defaultValue annotation in CML should be used only when a default value is not suitable to be defined in PCM due to specific modeling requirements.

When a default value is defined in PCM but the CML model has not been synced, the configurator still applies the PCM default. However, the value displayed in the CML model may become inconsistent with PCM.

To avoid such inconsistencies, it is recommended to run the Sync action in CML after updating default values in PCM, so that the CML model remains aligned with the latest PCM settings.

defaultValue Configuration Settings 

Associated ExampleConfigurable SpecifiedConfigurable ValuedefaultValue SpecifiedInitial Value BehaviorExample UI Result
Example 1Nodefault = TRUENoUses the first value in the domainAutomatically set to “Top Entry”
Example 2YesTRUENoUses the first value in the domainAutomatically set to “Bottom Entry”
Example 3YesFALSENoNo initial value is setField remains empty
N/AYesTRUEYesUses the value defined in defaultValueAutomatically set to “Side Entry”
N/AYesFALSEYesStill uses the value defined in defaultValueAutomatically set to “Side Entry”