check if object is deleted

I have a layout dxl column that displays info pulled in from another module based on OBJ_ID stored in the current module. However, the code would fail when the OBJ_ID is that of a object that has been deleted. Anyway to check to see if the object is deleted?

Attached is my layout DXL column code
{Code}
Module mTargetMod
Object oTarget
string sModName = "/Other Mod"

if(!(open module(sModName)))
mTargetMod = read(sModName, true, true)
else
mTargetMod = module item sModName

if(obj."OBJ_ID" "" != "")
{
oTarget = object(intOf(obj."OBJ_ID" ""), mTargetMod) //THIS WOULD FAIL WHEN OBJECT IS DELETED
if (isDeleted(oTarget))
display("DELETED")
else
display(oTarget."OTHER_MOD_INFO") //obj is current obj
}

{Code}
DOORS_USER - Thu Dec 02 12:28:39 EST 2010

Re: check if object is deleted
Tony_Goodman - Fri Dec 03 04:30:30 EST 2010

This looks like you are trying to use doors as a relational database by storing the identifier (key) of another object in an attribute.

I would suggest that you create links instead, then you can use the wizard to display information in a layout column.

Tony

Re: check if object is deleted
DOORS_USER - Fri Dec 03 08:59:04 EST 2010

Tony_Goodman - Fri Dec 03 04:30:30 EST 2010
This looks like you are trying to use doors as a relational database by storing the identifier (key) of another object in an attribute.

I would suggest that you create links instead, then you can use the wizard to display information in a layout column.

Tony

Tony,

Thanks for the recommendation. However, that's not an option for me. I was hoping that it's just my lack of DXL expertise that I couldn't figure out how to check if an object is deleted and DXL experts in this forum would be able to help.

Thanks!

Re: check if object is deleted
DOORS_USER - Fri Dec 03 09:27:17 EST 2010

DOORS_USER - Fri Dec 03 08:59:04 EST 2010
Tony,

Thanks for the recommendation. However, that's not an option for me. I was hoping that it's just my lack of DXL expertise that I couldn't figure out how to check if an object is deleted and DXL experts in this forum would be able to help.

Thanks!

Thanks all for taking the time to read this. Looks like a simple null object check was all I needed.
 

if (null oTarget)                                       //check is object is deleted
    display("DELETED")
  else
    display(oTarget."OTHER_MOD_INFO")

Re: check if object is deleted
llandale - Fri Dec 03 15:09:06 EST 2010

That 'object' search command is inferior in that it only finds objects that are currently displayed. If you need to use it to get a handle on a deleted object then you are going to have to tweak the 'display' of that open invisible module.

You can show all objects in that module with this:

current = mTargetMod    
filtering       off
outlining       off
showTables      on
level(0)
showDeletedObjects(true)
refresh mTargetMod


You may not need the refresh. OK, it won't show table/row objects.

You could also do a complete search of the module like this:

 

bool Found = false
int iAbsNo = intOf(obj."OBJ_ID" "")
for oTarget in entire mTargetMod do
{  if (identifier(oTarget) == iAbsNo) {Found = true; break}
}
if (Found) then use oTarget...


You should routinely use that 'entire' loop, as I believe all the others hide objects in various ways, read the DXL manual description carefully.

 

 

 

  • Louie