As with a Record, you define a DataItem outside of any other part. This automatically places the DataItem definition in package scope.
DataItem IDNumber CHAR(9) { minInput = 9, // requires 9 input characters isDecimalDigit = yes, // requires digits column = "SSN" // is related to a column } end
mySSN IDNumber;
You can declare that variable in a composite part such as a Record part or directly in a logic part such as a Program. In every case, the part type determines whether a given property is used.
In the current example, the column property is used only if the variable is declared in a record that is stereotyped for use with a relational database. The two validation properties are used only if the variable is declared in a user interface part.
You can use a data item variable anywhere that you can use a variable based on the same primitive data type as the data item. In other words, you can use mySSN from the previous example anywhere that you can use any other CHAR(9) variable.
Each primitive variable has a series of properties, whether by default or as specified in either the variable declaration or the DataItem part definition. Most of these properties are related to building a user interface; for more information, refer to the specific UI technology.