Re: Sequence Number Not Incrementing

2016-11-16 Thread Sujit Shah
I was trying to do a quick fix. Does not matter in this case if it skips
one.

Thanks all for pointing out why the sequence numbers were not incrementing.

Brain warp working overtime :-(


On Thu., 17 Nov. 2016 at 5:32 am, Alan Chan  wrote:

> Why do you want to do [contact_Listing]ID+1?
>
> I believe the command will add one to the number you entered next time
> sequence number is called. In your case, the system will skip one number.
>
> Alan Chan
>
> 4D iNug Technical <4d_tech@lists.4d.com> writes:
> >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)
>
> **
> 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:4d_tech-unsubscr...@lists.4d.com
> **
**
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:4d_tech-unsubscr...@lists.4d.com
**

Re: Sequence Number Not Incrementing

2016-11-16 Thread Alan Chan
Why do you want to do [contact_Listing]ID+1?

I believe the command will add one to the number you entered next time sequence 
number is called. In your case, the system will skip one number.

Alan Chan

4D iNug Technical <4d_tech@lists.4d.com> writes:
>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)

**
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:4d_tech-unsubscr...@lists.4d.com
**

Re: Sequence Number Not Incrementing

2016-11-16 Thread Kirk Brooks
Sujit,
I have a method that does much the same thing. Tactically here's how I
manage it:

1) determine the max ID number assigned, $maxID
2) loop through all the records and collect the dupes into a set
3) loop through the dupes and assign a new ID number. I increment $maxID
and assign that.
4) use set database parameter to make the sequence number $maxID+1

As others pointed out the sequence number doesn't auto increment when you
save a record. And this has to be performed when you are certain no new
records are being created.

On Wed, Nov 16, 2016 at 1:21 AM, Sujit Shah  wrote:

> Here I am trying to fix the Duplicates
>

-- 
Kirk Brooks
San Francisco, CA
===
**
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:4d_tech-unsubscr...@lists.4d.com
**

Re: Sequence Number Not Incrementing

2016-11-16 Thread John DeSoi
Sequence number does not increment unless you create or duplicate a record.

John DeSoi, Ph.D.



> On Nov 16, 2016, at 3:21 AM, Sujit Shah  wrote:
> 
> 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])

**
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:4d_tech-unsubscr...@lists.4d.com
**

Re: Sequence Number Not Incrementing

2016-11-16 Thread Keisuke Miyako
but the sequence number is only incremented when you create a record, not when 
you save.

> 2016/11/16 18:23、Sujit Shah  のメール:
> It is finding the duplicates but fails to increment the sequence number
> once the record is saved.



宮古 啓介
セールス・エンジニア

株式会社フォーディー・ジャパン
〒150-0043
東京都渋谷区道玄坂1-10-2 渋谷THビル6F
Tel: 03-6427-8441
Fax: 03-6427-8449

keisuke.miy...@4d.com
www.4D.com/JP

**
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:4d_tech-unsubscr...@lists.4d.com
**

Re: Sequence Number Not Incrementing

2016-11-16 Thread Bill Weale
But you are seeing a non-zero value?

(I ask because in v14 Mac OS, I’m trying to track down an instance where the 
field isn’t populated at all after I’ve duplicated a record but before I’ve 
saved it.)

Bill


William W. Weale

Business Owners Support, LLC.

Operations Analysis
MIS Advising
Decision Support Systems

> On Nov 16, 2016, at 4:23 AM, Sujit Shah  wrote:
> 
> It is finding the duplicates but fails to increment the sequence number
> once the record is saved.

**
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:4d_tech-unsubscr...@lists.4d.com
**

Re: Sequence Number Not Incrementing

2016-11-16 Thread Sujit Shah
It is finding the duplicates but fails to increment the sequence number
once the record is saved.

On Wed, Nov 16, 2016 at 8:21 PM, Sujit Shah  wrote:

> 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  wrote:
>
>> 4D iNug Technical <4d_tech@lists.4d.com> 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:4d_tech-unsubscr...@lists.4d.com
>> **
>>
>
>
>
> --
>
> xxx
> "There must be ingenuity as well as intention, strategy as well as
> strength. "
>
>



-- 

xxx
"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:4d_tech-unsubscr...@lists.4d.com
**

Re: Sequence Number Not Incrementing

2016-11-16 Thread Sujit Shah
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  wrote:

> 4D iNug Technical <4d_tech@lists.4d.com> 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:4d_tech-unsubscr...@lists.4d.com
> **
>



-- 

xxx
"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:4d_tech-unsubscr...@lists.4d.com
**

Re: Sequence Number Not Incrementing

2016-11-16 Thread Alan Chan
4D iNug Technical <4d_tech@lists.4d.com> 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:4d_tech-unsubscr...@lists.4d.com
**

Re: Sequence Number Not Incrementing

2016-11-16 Thread Keisuke Miyako
would you care to share some code that can reproduce your problem?

> 2016/11/16 17:42、Sujit Shah  のメール:
> Any tips?



宮古 啓介
セールス・エンジニア

株式会社フォーディー・ジャパン
〒150-0043
東京都渋谷区道玄坂1-10-2 渋谷THビル6F
Tel: 03-6427-8441
Fax: 03-6427-8449

keisuke.miy...@4d.com
www.4D.com/JP

**
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:4d_tech-unsubscr...@lists.4d.com
**

Sequence Number Not Incrementing

2016-11-16 Thread Sujit Shah
- The Table is Read Write
- SET DATABASE PARAMETER (Table Seq Nr) is set to one above the highest
value
- Record is Saved and not is Transaction

Any tips?


-- 

xxx
"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:4d_tech-unsubscr...@lists.4d.com
**