Setting Default Values with Procedures 

Use

You can use procedures to set default values for a characteristic, which can be overwritten by the user.

Use the following language element to set default values:

$SET_DEFAULT ($SELF, <characteristic>, <string>)

As the string, you can enter either a characteristic value or, for numeric characteristics, a calculation.

Setting a default value for a numeric characteristic:

  1. A configurable material has characteristics HEIGHT and WIDTH.
  2. The height is usually one and a half times the width, so you want to set this as a default value for characteristic HEIGHT.
  3. You define a procedure with the following source code:

$SET_DEFAULT ($SELF, HEIGHT, 1.5 * $SELF.WIDTH)

    1. Allocate the procedure to characteristic WIDTH or the configuration profile of the material.
    2. As soon as you enter a value for WIDTH, the procedure is triggered and sets the value of HEIGHT as one and a half time the WIDTH. You can change this value manually.

Features

If you delete the default value, it reappears as soon as you press enter, because the dependencies are processed again. You cannot define that no default value is entered for the characteristic.

You have the following options for deleting a default value:

- For single-value characteristics, the statement that no value is set can be expressed using an explicit additional value. The user can use this value to overwrite the default value.

- For multiple-value and restrictable characteristics, you can create an additional characteristic, ‘USE_DEFAULTS’, and use procedures with the expressions $SET_DEFAULT and $DEL_DEFAULT, to set or delete default values, according to the value assigned to this characteristic.

See also:

Deleting Default Values with Procedures