• 2 replies
  • Latest Post - ‏2014-04-10T17:50:49Z by llandale
36 Posts

Pinned topic Parent Obj

‏2014-04-08T21:05:45Z | child dxl loop obj parent

I have an easy question. I have one parent object that is the object current from where I'm running the script. This parent have child objects, so I did a "for" to the dxl run a routine to each child below that parent.

But for some reason the "for" isn't working. I even did a print to see where the problem is, maybe it was in the function, but no, when I did the print it didn't even get to the function.

But when I run the "for" logic outside the bigger dxl it work.

What I'm not seeing?


void groupSet(DBE calledFrom) {
Object po = current
infoBox "Open module as Shareable or Exclusive Edit."
return false
for reqmtObj in po do {
print "dois" 
Updated on 2014-04-08T21:06:22Z at 2014-04-08T21:06:22Z by braolive
  • Mike.Scharnow
    281 Posts

    Re: Parent Obj


    Is reqmtObj defined as "Object"? Is po really the correct object?

    Not sure, what "SetAll()" does, may be it changes the current object?

    Not sure what you want to do with the "save()". Is this "trigEvent_ save ()". If you want do "save (current Module)" you should do it outside the loop. Or is save() a function you overrode?

    Is there a filter defined, so that you cannot see the child objects?

    try adding

    print number(reqmtObj) " - " print number (po) "\n";


  • llandale
    3035 Posts

    Re: Parent Obj


    "po = current" means that it will get the Object that is current in the current Module, at that time.  It is probably getting set correctly but you need to be careful and mindful when using "current".  I would add the following:

    • print "in groupSet(), po = " identifier(po) "\t" number(po) "\n"

    Inside your loop, do this:

    • print "in groupSet(), reqmtObj = " identifier( reqmtObj) "\t" number(reqmtObj) "\n"

    Sure seems to me you need to send " reqmtObj" to function "SetAll()", and perhaps "save()" depending on what they do.  As coded, it seems "SetAll()" probably also gets the "current" object, which is repeatedly "po" not its children reqmtObj.

    Your "if(!canModify(reqmtObj)){" check should be lower inside your loop.

    Since function groupSet is type "void", you should just "return" and will get a DXL error if "return(false)" gets executed.

    Turn off Autodeclare_ and declare your local variables inside your local functions.  Use global variables sparingly.  As it is, "reqmtObj" may be defined or implied as a variable of type other than "Object" in code above the code you posted.