Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:33 pm
by Brendan Doolan >> Mon, 23 Feb 2004 10:01:36 GMT
Marcelle,
I am assuming your collection is man/auto so that you can add, clear etc on the collection? If so, then you should be able to fix up the problem using a workspace along the following lines
vars
saveColl : ObjectArray;
suspectColl : Collection;
obj : Any;
begin
create saveColl transient;
suspectColl := <grab a reference to your dodgy collection>;
foreach obj in suspectColl do
if global.isValidObject(obj.Object) then
saveColl.add(obj.Object);
endif;
endforeach;
beginTransaction;
suspectColl.clear;
foreach obj in saveColl do
suspectColl.add(obj);
endforeach;
commitTransaction;
I am assuming the the population is not huge so that the fixup can be done in one transaction. If this is not true you may need to save saveColl persistently in case there is an exception when running the workspace.
A more interesting question is how did it happen, has it happened more than once etc.?
Is this a consequence of having a man/auto inverse rather than a purely manual or purely auotmatic one? If so, maybe you ought to consider making it purely automatic?
Brendan