Topic
  • 2 replies
  • Latest Post - ‏2013-11-11T18:41:10Z by llandale
grasswistle
grasswistle
13 Posts

Pinned topic Iterating through deleted and undeleted objects

‏2013-11-08T19:47:05Z |

Hi,

So everyone knows this formula:

for o in m {...}

What I want is for o to not skip deleted items.  I want to go through every object in a module, whether they are deleted or not.  

I then need two things from each and every object: their absolute number and whether they are a deleted object or not.  To get the latter piece of information, could I use the function isDeleted?

Thanks,

Grasswistle

Updated on 2013-11-08T19:47:17Z at 2013-11-08T19:47:17Z by grasswistle
  • EHcnck
    EHcnck
    110 Posts
    ACCEPTED ANSWER

    Re: Iterating through deleted and undeleted objects

    ‏2013-11-09T02:20:48Z  

    Module currMod = current
    Object o       = null
    for o in entire currMod do {
        print probeAttr_(o, "Absolute Number") "\t" isDeleted(o) "\n"
    }

  • llandale
    llandale
    3035 Posts
    ACCEPTED ANSWER

    Re: Iterating through deleted and undeleted objects

    ‏2013-11-11T18:41:10Z  
    • EHcnck
    • ‏2013-11-09T02:20:48Z

    Module currMod = current
    Object o       = null
    for o in entire currMod do {
        print probeAttr_(o, "Absolute Number") "\t" isDeleted(o) "\n"
    }

    Yes.  I rarely if ever use the "for o in m do" loop as it is at the mercy of the fickle current view settings; filtering, levels, showing deleted objects, bla bla bla.  My object loops almost aways look like this:

    • for o in entire m do
    • {  if (isDeleted(o))   then continue
    •    if (ForSomeOtherReasonDisqualified(o))  then continue
    •    DealWith(o)
    • }

    -Louie

  • EHcnck
    EHcnck
    110 Posts

    Re: Iterating through deleted and undeleted objects

    ‏2013-11-09T02:20:48Z  

    Module currMod = current
    Object o       = null
    for o in entire currMod do {
        print probeAttr_(o, "Absolute Number") "\t" isDeleted(o) "\n"
    }

  • llandale
    llandale
    3035 Posts

    Re: Iterating through deleted and undeleted objects

    ‏2013-11-11T18:41:10Z  
    • EHcnck
    • ‏2013-11-09T02:20:48Z

    Module currMod = current
    Object o       = null
    for o in entire currMod do {
        print probeAttr_(o, "Absolute Number") "\t" isDeleted(o) "\n"
    }

    Yes.  I rarely if ever use the "for o in m do" loop as it is at the mercy of the fickle current view settings; filtering, levels, showing deleted objects, bla bla bla.  My object loops almost aways look like this:

    • for o in entire m do
    • {  if (isDeleted(o))   then continue
    •    if (ForSomeOtherReasonDisqualified(o))  then continue
    •    DealWith(o)
    • }

    -Louie