DOORS Attribute Type
In this article we will discuss DOORS attribute type – how to list all attribute types, create a new attribute type, create an enumerated type attribute.
In IBM DOORS, an attribute type defines the kind of data that can be stored in an attribute. When creating or modifying an attribute, you must choose an attribute type that best suits the kind of data you want to store.
Here are some of the commonly used attribute types in IBM DOORS:
- Text: This attribute type is used to store plain text data, such as names, descriptions, or comments.
- Integer: This attribute type is used to store whole number data, such as counts or quantities.
- Real: This attribute type is used to store decimal number data, such as measurements or percentages.
- Date: This attribute type is used to store dates and times, such as project deadlines or milestones.
- Enumeration: This attribute type is used to store a predefined set of values, such as status codes or priority levels. The values can be displayed as a drop-down list, making it easy to select the appropriate value.
These are just some of the attribute types available in IBM DOORS. Choosing the right attribute type for your data is important to ensure that your data is stored correctly and can be easily searched and filtered.
List DOORS Attribute Type
All the attribute types in DOORS can be listed/printed using a very simple dxl code –
// www.TheCloudStrap.Com /************************************************************************ * $FILENAME: attrtype1.dxl * $DESCRIPTION: DXL Attribute Type operation * * NOTICE: Copyright www.TheCloudStrap.Com. All rights reserved. * Software comes without any warranties and guarantees, is provided * as is and is not supported. Use this software at your own risk. * Authors resume no liabilities. * * Contact: admin {at} TheCloudStrap.com ************************************************************************/ // DXL Attribute Type operation Module m = current AttrType at //print list of attribute type in current module for at in m do { print at.name "\n" // check if enumerated base type print "Enumeration = " if (at.type == attrEnumeration) { int i = 0 for(i=0; i<at.size; i++){ print " " at.strings[i] ", " } print "\n" } } print "Done!"
Here is the output window that lists all the different types of attribute types in the current module –
Create Attribute type
To create a new attribute type, you can use create() function in DXL. To modify an attribute type, the user must have access to it. The canWrite() function can be used to check if the user has write access to it. The user will be able to change/create attribute only in exclusive edit mode. Therefore, the user needs to manually open the module in exclusive edit mode before running the following script.
Here is the declaration of create() function –
AttrType create(string name, AttrBaseType abt, string &errmess)
AttrType create(string name, {int|real|Date} min, {int|real|Date} max, string &errmess)
AttrType create(string name, string codes[ ], [int values[ ], [int colors[ ],] [string descs[ ],] [string URI[ ],] string errmess)
If the operation fails, all forms of create return an error message in errmess.
The function also throws a run-time DXL error for an invalid input, for example a duplicate type name. These errors can be trapped using lastError and noError.
The first form creates a new attribute type, of name name and base type abt
The next form creates a new attribute type named name, of base type int, real or Date, for a range of min to max.
The last form creates enumeration types named name, using enumeration names codes, with optional values values, colors colors, descriptions descs, and URI URI. The argument URI[] is the URI for each value.
Here is an example of how to create a new attribute type in DOORS DXL –
// www.TheCloudStrap.Com /************************************************************************ * $FILENAME: attrtype2.dxl * $DESCRIPTION: DXL Attribute Type operation * * NOTICE: Copyright www.TheCloudStrap.Com. All rights reserved. * Software comes without any warranties and guarantees, is provided * as is and is not supported. Use this software at your own risk. * Authors resume no liabilities. * * Contact: admin {at} TheCloudStrap.com ************************************************************************/ // DXL Attribute Type operation Module m = current AttrType at string errmsg = null // AttrType create (string name, AttrBaseType, string &erroMsg) at = create ("INT_TYPE", attrInteger, errmsg) if (null errmsg) print "'INT_TYPE' created successfully! \n" at = create ("REAL_TYPE", attrReal, errmsg) if (null errmsg) print "'REAL_TYPE' created successfully! \n" at = create ("STR_TYPE", attrString, errmsg) if (null errmsg) print "'STR_TYPE' created successfully! \n" // AttrType create (string name, int min, int max, string &errMsg) at = create ("INT8_TYPE", 0, 127, errmsg) if (null errmsg) print "'INT8_TYPE' created successfully! \n" at = create ("INT16", 0, 32767, errmsg) if (null errmsg) print "'INT16_TYPE' created successfully! \n" print "Done!"
The output windows confirms that the ‘REAL_TYPE’, ‘STR_TYPE’, ‘INT8_TYPE’, ‘INT16_TYPE’ have been created –
Create Enumeration Type
To create a new enumerated attribute type, you can use create() function in DXL. Here is an example of how to create a new attribute type in DOORS DXL –
// www.TheCloudStrap.Com /************************************************************************ * $FILENAME: attrtype3.dxl * $DESCRIPTION: DXL Attribute Type operation - create Enum Type * * NOTICE: Copyright www.TheCloudStrap.Com. All rights reserved. * Software comes without any warranties and guarantees, is provided * as is and is not supported. Use this software at your own risk. * Authors resume no liabilities. * * Contact: admin {at} TheCloudStrap.com ************************************************************************/ // DXL Attribute Type operation - create Enum Type Module m = current AttrType at string errmsg = null // create enumeration type string enum_names[] = {"Pending", "In-Progress", "Done"} int enum_vals[] = {0, 1, 2} int enum_colors[] = {realColor_Red, realColor_Yellow, realColor_Green} setRealColorOptionForTypes (true) at = create ("ReqStatusType", enum_names, enum_vals, enum_colors, errmsg) if (null errmsg) print "'ReqStatusType' enumeration type was created successfully! \n" print "Done!"
‘ReqStatusType’ type is now created as shown below –
The ‘ReqStatusType’ has now three options – Pending, In-Progress, and Done.
Conclusion
In this article we have discussed DOORS attribute type – how to list all attributes, how to create a new attribute type, how to create enumerated type attribute etc.
This post was published by Admin.
Email: admin@TheCloudStrap.Com