Alan: Though it shouldn't make a difference, are you testing this scenario on different data files?
-- Douglas von Roeder 949-336-2902 On Sat, Aug 20, 2016 at 12:00 PM, Alan Tilson <[email protected]> wrote: > Hello out there, > A little more information might shed light on something, like > > 1. the array is created with Selection to Array > 2. the values that give the wrong Count are always the same > 3. they give these bad Count values immediately after the array is > created. > > I'm baffled! > Alan > > > On Fri, Aug 19, 2016 at 6:16 PM, Alan Tilson <[email protected]> wrote: > > > Hello again, > > A bit more testing indicates this error only occurs when the starting > > element is more than 1, at least in my example. > > The result should be 2 (elements 2 & 3) and it is 2 if I start with 1 but > > the result is 4 if I start with 2! > > And it seems only to occur when the result is greater than 1. > > Thanks, > > Alan > > > > On Fri, Aug 19, 2016 at 6:07 PM, Alan Tilson <[email protected]> > wrote: > > > >> Hello everyone, > >> > >> I have a method whose purpose is to delete the values from one array > (a1) > >> from another array (a2). > >> So I > >> > >> 1. Sort both arrays > >> 2. Loop through the the array containing the values (a1) to be > deleted > >> 1. Use Find in Array to see if the value in a1 is present in a2 > >> 1. If yes, use Count in Array to determine the number to be > >> deleted > >> 2. Use DELETE FROM ARRAY to the number of elements found > >> > >> I have found situations in v13.3, v13.6 and v15.0 where the number of > >> elements counted in step 2.1.1 does not match the Debug windows display > of > >> the array. > >> > >> The basic code is below. And it works at least 90% of the time. > >> > >> Any ideas would be appreciated! I have written a replacement for this > >> function but I am having a hard time believing that something this basic > >> doesn't work... > >> > >> Thanks, > >> Alan Tilson > >> > >> $pAr_DeleteFrom:=$1 > >> $pAr_ValuesToDelete:=$2 > >> $count_i:=$3 > >> > >> SORT ARRAY($pAr_DeleteFrom->;>) > >> SORT ARRAY($pAr_ValuesToDelete->;>) > >> > >> $start:=0 > >> For ($el;1;Size of array($pAr_ValuesToDelete->)) > >> > >> $_ValueToDelete:=$pAr_ValuesToDelete->{$el} > >> $start:=Find in array($pAr_DeleteFrom->;$_ValueToDelete;$start) > >> If ($start=-1) > >> > >> $start:=0 > >> > >> Else > >> > >> $count_toDelete:=Count in array($pAr_DeleteFrom->;$_ > ValueToDelete;$start) > >> > >> DELETE FROM ARRAY($pAr_DeleteFrom->;$start;$count_toDelete) > >> > >> End if > >> > >> End for > >> > > > > > ********************************************************************** > 4D Internet Users Group (4D iNUG) > FAQ: http://lists.4d.com/faqnug.html > Archive: http://lists.4d.com/archives.html > Options: http://lists.4d.com/mailman/options/4d_tech > Unsub: mailto:[email protected] > ********************************************************************** > ********************************************************************** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:[email protected] **********************************************************************

