« Back

Boolean Attribute Type

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Boolean Attribute Type
community documentation attribute type
Answer
3/27/14 11:06 AM
How to define a boolean attribute for boolean data types?

RE: Boolean Attribute Type
Answer
1/20/14 8:37 AM as a reply to Fadi.
ADOxx does not provide an explicit way to specify attributes of type BOOLEAN. To define an attribute that is interpreted as a BOOLEAN, two alternative implementation approaches are available:

1) INTEGER: a boolean can be implemented as an attribute of type INTEGER with the value domain 0 and 1 (this could be potentially restricted using the numeric value domain specification. ADOxx will interpret a value of 1 as TRUE a value of 0 as false. Steps to create an attribute are:

a) Define a new attribute of type INTEGER for your modelling class/relation class
b) Define the numeric valid domain to allow only 0 or 1 as possible values in the attrubite facet "AttributeNumericDomain"

1DOMAIN
2message:"Only attribute values 0 or 1 are allowed."
3INTERVAL
4lowerbound:0
5upperbound:1


c) Define the default value (0 or 1) to be used if a new instance is created

d) For the representation in the notebook control types for attributes can be applied. To define this controltype, add the following to the AttrRep specification of the class:

1NOTEBOOK
2CHAPTER "X"
3...
4ATTR "IntegerAttribute" ctrltype:check

The graphical representation is shown in the attached screenshot. The advantage of this approach is that no conversation of values in scripts and expressions is needed and can be used as derived through e.g. CC "Core" GET_ATTR_VAL commands in AdoScript.

b) ENUMERATION: as an alternative, and to allow to define explicitly value for TRUE and FALSE on selection, the attribute type ENUMERATION can be used to implement a BOOLEAN attribute. The enumeration is defined with 2 possible outcomes, that can be mapped to the TRUE and FALSE states using control types as above for the notebook representation
Attachment

Attachment

Attachments: BOOLEANasENUMERATION.PNG (7.4k), BOOLEANasINTEGER.PNG (36.3k)