Using v17:

I have a method that recursively deletes records from related tables.
Something like this (vastly simplified):

// recursiveDelete
$tablenumber:=$1
$TablePtr:=table(tablenumber)
all records(TablePtr->)
create named selection(TablePtr->;"$deletes")
for($i;1;records in selection(TablePtr->))
    // find related records in another table - eg table no. 2
    recursiveDelete(2)
    use named selection("$deletes")
    next record(TablePtr->)
end for

The problem is that the named selection $deletes seems to work like a
process variable instead of a local variable. IE if on the first iteration
there are 200 records in $deletes, and on the second iteration there are 0
records in $deletes, then when it loops back to the first iteration there
are 0 records in $deletes whereas there should be 200.

Is it supposed to work like that? It isn't logical, Mr. Spock.

My workaround is to keep track of the iteration level and create a new set
name for each level.
The same thing happens with both named selections and sets.

Pat


-- 
*************************************************
CatBase - Top Dog in Data Publishing
tel: +44 (0) 207 118 7889
w: http://www.catbase.com
skype: pat.bensky
*************************************************
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to