I'm with Bruce.

ContactID INTEGER NOT NULL PRIMARY KEY

SET VAR vNext INTEGER
SELECT (MAX(ContactID +1)) INTO vNext FROM Contacts
AUTONUM ContactID in Contacts USING .vNext,1

The above is my standard system to restarting the autonumbers when an index fouls up -- an increasingly rare situation, by the way.

I actually have a stored procedure that will look for autonumbered columns and reset the numbers as shown above.

Albert

On 2016-05-21 11:05 PM, Bruce Chitiea wrote:
Gary:
Happy to help.
I highly recommend an R:BASE web resource:
www.rsyntax.com/rbgX <http://www.rsyntax.com/rbgX>
... for rapid reference on most things R:BASE. The section on AUTONUM does say: /"The following types of columns can be autonumbered: ... Columns with DOUBLE, INTEGER, NUMERIC, REAL, or TEXT data types."/
... and shows the syntax for concatenating text and sequential numbering:
*/[MX]9999 or [xx]0000/*
But I leave it to others to extol the virtue of TEXT autonumbers, for I'm exclusively an INTEGER-autonumber guy. My philosophy is this: an autonumber has no repeat no meaning beyond being a unique "serial number" for a row of data. No meaning (such as PO, SO, INV, SN etc.) is embedded or implied by the number. It is a number, nothing more, existing solely to allow a PK to be an effective and unambiguous "anchor" for an FK. Because rows can be deleted, I do not assume perfect 1+1+1 sequence to the PK values in the rows I'm running through a loop, which would be wrongly (and perhaps fatally) assigning "sequentiality" as a meaning. There's a cheap and cheerful method for "walking" a list of non-sequential PK values. A subject for another day.
Yours,
Bruce Chitiea
SafeSectors, Inc.
909.238.9012 Mobile
------ Original Message ------
Sent: 5/21/2016 9:39:52 PM
Subject: Re: Re[2]: [RBASE-L] - Autonumbering Not Working
From: "Gary Randall" <[email protected] <mailto:[email protected]>>
To: [email protected] <mailto:[email protected]>
Cc:
Bruce,
I had the data type as text I changed it to integer and now it works correctly!

I thought the data type could be text maybe it's changed?

Thank you for helping me.
Gary

On May 21, 2016, at 9:24 PM, Bruce Chitiea <[email protected] <mailto:[email protected]>> wrote:

Gary:
Nor have I. I take from your response that the PK has not yet been applied.
More clarity needed. At the R>, if you LIST <TableNameHere>, do you get:
1 WannaBePKColumn   Type   : INTEGER  NOT NULL AUTONUMBER
Bruce
------ Original Message ------
Sent: 5/21/2016 8:44:13 PM
Subject: RE: [RBASE-L] - Autonumbering Not Working
From: "Gary Randall" <[email protected] <mailto:[email protected]>>
To: [email protected] <mailto:[email protected]>
Cc:

I am using RBase X, I have a very basic database design at this point. I created an autonumbering column using the Data Designer with the intention of using this column as a Primary Key. I tried entering some test data and noticed the autonumbering column was not being inserted when the row is added. If I had the PK assigned, I would get the error msg telling me that a Null value was not allowed. If the PK was removed the row would be loaded but the autonumber column would be NULL. I’ve never seen this before.

Thank you

Gary Randall

*From:*[email protected] <mailto:[email protected]> [mailto:[email protected] <mailto:[email protected]>] *On Behalf Of *Bruce Chitiea
*Sent:* Saturday, May 21, 2016 8:32 PM
*To:* [email protected] <mailto:[email protected]>
*Subject:* Re: [RBASE-L] - Autonumbering Not Working

Gary:

Would you kindly explain what "not working" means? Several questions:

- Which version of R:BASE?

- Are you setting the autonumber within the data designer? With the AUTONUM command in code?

- Problem manifests while INSERTing in code or running against an existing table in EDIT mode?

Thanks

Bruce Chitiea

SafeSectors, Inc.

909.238.9012 Mobile

------ Original Message ------

Sent: 5/21/2016 8:23:04 PM

Subject: [RBASE-L] - Autonumbering Not Working

From: "Gary Randall" <[email protected]_ <mailto:[email protected]>>

To: [email protected]_ <mailto:[email protected]>

Cc:

Hello All,

I am creating a new database and during testing I found the column autonumbering function is not working. Is there a setting I need to change to get RBase to auto number when a new row is added?

Thank you

Gary Randall

--
You received this message because you are subscribed to the Google Groups "RBASE-L" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]_ <mailto:[email protected]>.
For more options, visit _https://groups.google.com/d/optout_.

--
You received this message because you are subscribed to the Google Groups "RBASE-L" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]_ <mailto:[email protected]>.
For more options, visit _https://groups.google.com/d/optout_.

--
You received this message because you are subscribed to the Google Groups "RBASE-L" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "RBASE-L" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "RBASE-L" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "RBASE-L" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups 
"RBASE-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to