How do I clear a GROUP containing a GROUP with a DIM() Array?

Hello again Genricke

I have made changes to your EasyClear to use howmany() for arrays as mentioned in my earlier message above.

EasyClear  Procedure(*Group MyGroup) !,long,proc
lCount     Long
aFieldRef  Any,Auto
pGroupRef  &Group
dimCount   long,auto
x          long,auto
  code  
  loop
    lCount += 1
    aFieldRef &= What(MyGroup, lCount)
    if aFieldRef &= Null then break.  ! End of Group

    dimCount = howmany(MyGroup, lCount)
    x = 1
    if dimCount > 1 then aFieldRef &= What(MyGroup, lCount, 1).
    loop
      if IsGroup(MyGroup, lCount)
        pGroupRef &= GetGroup(MyGroup, lCount, choose(dimCount > 1,x,0))
        if x >= dimCount
          lCount += easyClear(pGroupRef)
        else
          easyClear(pGroupRef)   
        end
      else
        clear(aFieldRef)
      end
      if x >= dimCount then break.
      x += 1
      aFieldRef &= What(MyGroup, lCount, x)
      if aFieldRef &= Null then break. ! just in case - should NOT happen
    end
  end
  return lCount - 1

OK well hopefully that works. If it doesn’t then please show an example where it fails and I will have a look at it - but as Jeff suggests, it is good to be polite and kind to those who are trying to help!

cheers again

Geoff R

2 Likes