I have seen some modules that have a parent object, and each object underneath the parent, all child objects, are under each preceding object. |
Re: Script to determine if a child object exists under a child object. Tab behaves differently in Chrome. Parent Child Child Child Child For normal modules Parent Child Child Child Child I wish for the script to find that the second Child object is below the first Child object, and each subsequent child objects that have a child that are not in the normal module pattern. Does such a script exist? Thank you. |
Re: Script to determine if a child object exists under a child object.
Parent
Child1
Child2
Child3
Child4
|
Re: Script to determine if a child object exists under a child object. Gedinfo - Wed Nov 07 10:09:17 EST 2012
Parent
Child1
Child2
Child3
Child4
Hi,
if (Child1 == parent(child2)) {
etc...
}
|
Re: Script to determine if a child object exists under a child object. Gedinfo - Wed Nov 07 09:41:36 EST 2012
Hi,
Object o = current
Object oChild;
// This loop will respect the current display set, e.g. filters, show deleted objects, etc.
for oChild in o do { print "Found child: " (identifier oChild) "\n" }
// This loop will not respect the display set
for oChild in all o do {
if (isDeleted oChild) continue // skip over deleted objects
print "Found non deleted child: " (identifier oChild) "\n"
}
// This will again respect the display set, e.g. filters, ...
print "The 2nd visible child of the current object is: " (identifier o[2]) "\n"
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
Re: Script to determine if a child object exists under a child object. Gedinfo - Wed Nov 07 09:41:36 EST 2012 I think you are asking that you want to find this structure...
... when it should look like this:
Let me scibble:
bool IsLegalParent(Object o)
{ // Determine if this object qualifies as a "Parent".
// Not sure what this means for you, but perhaps:
string Heading = o."Object Heading"
return(!null Heading)
} // end IsLegalParent()
bool IsParent_Legal, IsParent_Actual
Object o
Module mod = current()
for o in entire mod do
{ if (isDeleted(o)) continue
IsParent_Legal = IsLegalParent(o)
IsParent_Actual = !null o[1] // Is there a child object?
if ( IsParent_Legal and IsParent_Actual) then{} // No Problem
elseif( IsParent_Legal and !IsParent_Actual) then {error, Parent has no children}
elseif(!IsParent_Legal and IsParent_Actual) then {error, Child has child objects}
elseif(!IsParent_Legal and !IsParent_Actual) then {} // no problem
else{} // all cases already covered
}
|
Re: Script to determine if a child object exists under a child object. |
Re: Script to determine if a child object exists under a child object. Gedinfo - Thu Nov 08 13:18:07 EST 2012 See the script in post http://www.ibm.com/developerworks/forums/thread.jspa?threadID=459257&tstart=0 The "Structure" column should indicate the info you require |