In this article, we will explain the DOORS DXL Items using a few programs.
DOORS DXL Items
An Item in DOORS is a reference to an item within a Project or Folder. Both Project and Folder are considered as DOORS DXL Items.
Item Referencing
There are three different ways to reference an Item in the DOORS DXL environment –
- Absolute reference – this always starts with a forward slash (/)
- Reference relative to the current folder that starts with the (../)
- Reference relative to the current folder containing no slash
Here is an example of different styles of referencing an Item –
Project p1 = create (“/Project_Sample_1”, “”) // Absolute Database Reference
Project p2 = create (“/Project_Sample_1/Project_Sample_2”, “”) // Absolute Database Reference
Project p3 = create (“../Project_Sample_3”, “”) // Reference relative to current folder with (../)
Project p4 = create (“Project_Sample_4”, “”) // Reference relative to current folder with no slash
Here is the syntax on how to navigate to the Projects with an Item reference –
for <Item &ItemReference> in <Project> do {
……….
}
The above loop iterates over all the projects and returns the references to undeleted items at all levels within a Project.
Here is an example DXL code snippet –
// www.TheCloudStrap.Com /************************************************************************ * $FILENAME: itm1.dxl * $DESCRIPTION: DXL Item example * * 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 ************************************************************************/ // Example of Item string itmName = null Item itmRef = null // print "Current Project all Items - \n" for itmRef in current Project do { print name(itmRef) "\n" } // print "Current Project Top Items - \n" for itmName in current Project do { print itmName "\n" }
Here is the syntax on how to navigate to the Folders with an Item reference –
for <Item &ItemReference> in <Folder> do {
……….
}
The above loop iterates over all the folders and returns the references to undeleted top-level folder items. It does not return the deleted items.
for <Item &ItemReference> in all <Folder> do {
……….
}
The above loop iterates over all the folders and returns the references to all top-level folder items.
Here is an example DXL code snippet –
// www.TheCloudStrap.Com /************************************************************************ * $FILENAME: itm2.dxl * $DESCRIPTION: DXL Item example * * 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 ************************************************************************/ // Example Folder navigation Item itmRef = null // print all folder items print "All Folder Items - \n" for itmRef in all current Folder do { print name(itmRef) "\n" } //print undeleted folder items only print "Undeleted Folder Items - \n" for itmRef in current Project do { print name(itmRef) "\n" }
Item – Path and Full Name
The path() and fullName() functions return the path and the full name of an item respectively.
// www.TheCloudStrap.Com /************************************************************************ * $FILENAME: itm3.dxl * $DESCRIPTION: DXL Item example * * 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 ************************************************************************/ // Example of Path and Fullname Folder f = folder("/DOORS_Training/Sample_Project/Try1") print "Name of the folder = " name(f) "\n" print "Path of the folder = " path(f) "\n" print "Full Name of the folder = " fullName(f) "\n"
Item – Parent Project
The getParentProject() function returns the reference to the parent project of the item.
// www.TheCloudStrap.Com /************************************************************************ * $FILENAME: itm4.dxl * $DESCRIPTION: DXL Item example * * 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 ************************************************************************/ // Example of Parent Project // Project getParentProject(Item itm) // Project getParentProject(Folder f) // Project getParentProject(Project p) // Project getParentProject(Module m) // Project getParentProject module(string moduleName) Item itm = null Project p = null for itm in current Folder do { p = getParentProject(itm) if (null p) continue else print name(itm) " Parent Project is = " name(p) "\n" }
Item – Parent Folder
The getParentFolder() function returns the reference to the parent folder of the item.
// www.TheCloudStrap.Com /************************************************************************ * $FILENAME: itm5.dxl * $DESCRIPTION: DXL Item example * * 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 ************************************************************************/ // Example of Parent Folder // Project getParentFolder(Item itm) // Project getParentFolder(Folder f) // Project getParentFolder(Project p) // Project getParentFolder(Module m) // Project getParentFolder module(string moduleName) Item itm = null Folder f = null for itm in current Folder do { f = getParentFolder(itm) if (null f) continue else print name(itm) " Parent Project is = " name(f) "\n" }
Item – Query
There are a few utility functions that can be used to know the status of an item in DXL.
// www.TheCloudStrap.Com /************************************************************************ * $FILENAME: itm6.dxl * $DESCRIPTION: DXL Item example * * 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 ************************************************************************/ // Example of Item Item itm = null print "Current Folder is = " name(current Folder) "\n" // item type could be - 'Folder', 'Project', 'Formal', 'Link' for itm in current Folder do { print "Item " name(itm) " of type " type(itm) "\n" }
Here is the output –
Conclusion
In this article, we have explained the DOORS DXL Items using a few programs. If you have any questions, feel free to comment down below.
This post was published by Admin.
Email: admin@TheCloudStrap.Com