Here I am setting the seq number

ALL RECORDS([Contact_Listing])
ORDER BY([Contact_Listing];[Contact_Listing]ID;>)
LAST RECORD([Contact_Listing])
SET DATABASE PARAMETER([Contact_Listing];Table sequence
number;[Contact_Listing]ID+1)


Here I am trying to fix the Duplicates

C_POINTER($oTable;$oTableID)
ARRAY LONGINT($alDistinctIDs;0)
$oTable:=Table(Table(->[Contact_Listing]))
$oTableID:=Field(Table(->[Contact_Listing]);Field(->[Contact_Listing]ID))
ALL RECORDS($oTable->)
$lNumRecs:=Records in selection($oTable->)
DISTINCT VALUES($oTableID->;$alDistinctIDs)
If ($lNumRecs#Size of array($alDistinctIDs))  // found some duplicates
  // build a list of duplicate IDs
ARRAY LONGINT($alDuplicateIDs;0)
SET QUERY DESTINATION(Into variable;$lDupCount)
For ($i;1;Size of array($alDistinctIDs))
QUERY($oTable->;$oTableID->=$alDistinctIDs{$i})
If ($lDupCount>1)
APPEND TO ARRAY($alDuplicateIDs;$alDistinctIDs{$i})
End if
End for
SET QUERY DESTINATION(Into current selection)
End if
READ WRITE([Contact_Listing])
For ($i;1;Size of array($alDuplicateIDs))
QUERY([Contact_Listing];[Contact_Listing]ID=$alDuplicateIDs{$i})
While (Not(End selection([Contact_Listing])))
[Contact_Listing]ID:=Sequence number([Contact_Listing])`HERE IT IS GIVING
THE SAME SEQUENCE NUMBER TWICE
SAVE RECORD([Contact_Listing])
NEXT RECORD([Contact_Listing])
End while
End for
READ ONLY([Contact_Listing])

On Wed, Nov 16, 2016 at 8:05 PM, Alan Chan <[email protected]> wrote:

> 4D iNug Technical <[email protected]> writes:
> >- The Table is Read Write
> >- SET DATABASE PARAMETER (Table Seq Nr) is set to one above the highest
> >value
>
> Are you sure the table was set as defaulted table? I always include the
> table parameter.
> >
> >- Record is Saved and not is Transaction
> >
> You mean the record was not saved in transaction or it was saved but
> doesn't generate correct sequence number?
>
> Alan Chan
>
> **********************************************************************
> 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]
> **********************************************************************
>



-- 

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
"There must be ingenuity as well as intention, strategy as well as
strength. "
**********************************************************************
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]
**********************************************************************

Reply via email to