Home » Data model (DataTypes) » EnumTypes

EnumTypes

Its Very similar like the Enum concept in Java or C, EnumerationTypes (EnumType) are also used in SAP Commerce Cloud.

EnumTypes are ComposedTypes and handle values in a different way than other datatypes:

Enum_1

Example : an EnumType called Gender with the values MALE and FEMALE has two instances: MALE and FEMALE.

<enumtype code="Gender" autocreate="true" generate="true">
    <value code="MALE"/>
    <value code="FEMALE"/>
</enumtype>

This kind of type is useful for attributes whose values only have a limited number of choices (Male or Female, for example).

More about  Enum:

If you define EnumTypes yourself with default platform items as values, those values are always instances of this new EnumType

.As a result, all the values for self-defined EnumTypes are stored in the same database table as the EnumType itself. Since all EnumTypes end up in one single database table, however, this table might become quite large when you define a lot of EnumTypes. If you know that an EnumType might have a large number of values, it is recommended to use a different database table to deploy this EnumType.

 

Use:
we can use this kind of Enum in Itemtypes.

For example:

Gender Enumtype can be used Customer ItemType.