2 things: 1 - why not all records order by([table];[table]ID_Field;<) $New_Sequence_Value:=[table]ID_Field+1 then you are sure to exceed the last assigned value.
2 - try assigning **Table*($iTableNumber)* to a local variable, and then dereference, sometime 4D does not like to dereference equations as a parameter to a command. Chip On Mon, 15 Oct 2018 17:56:58 +0100, Pat Bensky via 4D_Tech wrote: > I have a method that creates record numbers using the Sequence number. I'm > running into a situation where I am getting duplicate record numbers for > some reason. So I added some code to check and - supposedly - fix it by > resetting the table sequence number, but it doesn't seem to work. > > This is what I'm doing: > > $Sequence:=*Sequence number*(*Table*($iTableNumber)->) > > *If* (*Find in field*(*$1*->;$Sequence)>-1) // $1 is a pointer to the > record number field > > *While* (*Find in field*(*$1*->;$Sequence)>-1) > > $Sequence:=$Sequence+1 > > *End while* > > *SET DATABASE PARAMETER*(*Table*($iTableNumber)->;Table sequence number; > $Sequence) > > *End if* > > *$1*->:=*Sequence number*(*Table*($iTableNumber)->) > > Suppose $Sequence = 4496 when we get to the SET DATABASE PARAMETER line. > > Then the next call to *Sequence number* should return 4497, right? But it > doesn't. It returns 4495. > > > Any suggestions as to what I'm doing wrong here? > > Note- this is not happening inside a transaction. > > > 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] > ********************************************************************** --------------- Gas is for washing parts Alcohol is for drinkin' Nitromethane is for racing ********************************************************************** 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] **********************************************************************

