« Back

Mandatory check on RECORD attributte

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Mandatory check on RECORD attributte
community attrrep documentation query adoscript
Answer
27/03/14 11:45
I've defined a RECORD "Posicion" with two integer attributes "x" and "y". They are mandatory and their default value is "0". (Image 1)

The property "RecordClassMultiplicity" has the value "1". When I add a row, the attribute "Posicion" shows in black indicating its value is ok, but the columns "x" and "y" still have "0" value. (Image 2). It should be in black when the attributes "x" and "y" are different of  "0".

I want to check, before closing the window, that the "x" and "y" values are bigger than 0. How could I do it?
Attachment

Attachment

Attachments: Image 1.png (32.2k), Image 2.png (32.5k)

RE: Mandatory check on RECORD attributte
Answer
07/03/14 13:55 as a reply to Anonymous.
If you have used the keyword mandatory for the attribute "Posicion" in the AttrRep of the class "Puerta", the field is displayed in red only when the table is empty (standard value). As soon as you have a row in the table, the attribute name is black, as the current value of the attribute "Posicion" and the default value (empty) are different. Unfortunately, the "mandatory" keyword has no effect in the AttrRep definition of the RecordClass used for the Table attribute.
However, since the RecordClassMultiplicity is set to 1, meaning that you can only have one row, why not define two separate attributes, x_Posicion and y_Posicion, and use the keyword "mandatory" for them? These two attributes may be placed inside a GROUP, called "Posicion" and the AttrRep code would look like this:
1NOTEBOOK
2...
3CHAPTER "Description"
4GROUP "Posicion"
5ATTR "x_Posicion" mandatory
6ATTR "y_Posicion" mandatory
7ENDGROUP
8...

RE: Mandatory check on RECORD attributte
Answer
07/03/14 14:01 as a reply to Anonymous.
The script that implements a custom check of the mandatory attributes for every object in a model also includes functionality for testing the mandatory condition for every column in every attribute of type TABLE.
Please check this post:

http://www.adoxx.org/live/faq/-/message_boards/message/77188