Thanks Gunnar. That's how I got into trouble in the first place... Sent from my iPhone
On Aug 11, 2010, at 11:51 PM, "Gunnar Ekblad" <[email protected]> wrote: > Claudine > > You can always use : > SELECT (MAX(Invoiceno) + 1) Into vinvoiceno INDIC ivinvoiceno FROM Invoice > > That will work when the column is not an autonum > > Gunnar Ekblad > Kontema IT AB > Hästholmsvägen 32 > 131 30 Nacka > Sweden > > > -----Ursprungligt meddelande----- > Från: [email protected] [mailto:[email protected]] För Claudine Robbins > Skickat: den 12 augusti 2010 04:10 > Till: RBASE-L Mailing List > Ämne: [RBASE-L] - RE: FW: Question to RBASE List > > Dan, > > Thanks for your response. > > I'll give NEXT a try. I saw this in the help file but since I don't have an > autonumbered column, I'll have to create one. > > Claudine > > > ________________________________________ > From: [email protected] [mailto:[email protected]] On Behalf Of Dan Goldberg > Sent: Wednesday, August 11, 2010 12:40 PM > To: RBASE-L Mailing List > Subject: [RBASE-L] - RE: FW: Question to RBASE List > > You want to use the next function to solve this. That way it grabs the > number and increments the autonumber. > > This is from the help file: > > (NEXT(tblname,autonumcol)) > > Returns the next value of an autonumbered column. > > Where colname is an autonumbered column in tblname NEXT returns, and > increments, the value of the next available autonumber . You cannot use this > function with INSERT, but you can use it with LOAD;NONUM. For example: > Assume that you have autonumbered the column EmployeeID in the table > Employees. The highest number currently used in the database is 134. In this > case, in the following example, the value of vNextOne will be 135 and the > value of vNextTwo will be 136. > > Notice that the value has incremented even though no other commands or > functions were issued. > > SET VAR vNextOne = (NEXT(Employees,EmployeeID)) > > > SET VAR vNextTwo = (NEXT(Employees,EmployeeID)) > Dan > > > > -----Original Message----- > From: [email protected] [mailto:[email protected]] On Behalf Of Adriana > Montano > Sent: Wednesday, August 11, 2010 10:27 AM > To: RBASE-L Mailing List > Subject: [RBASE-L] - FW: Question to RBASE List > > > -----Original Message----- > From: Claudine Robbins > Sent: Wednesday, August 11, 2010 12:23 PM > To: Adriana Montano > Subject: Question to RBASE List > > Can you please forward this message to the list? Apparently, it no longer > works with this email address: > > > Good morning list, > > I have a problem with generating unique primary keys. > > The first routine, found in an RBTI sample, would pick the next value in the > PK column of the table, then would check and make sure the key was not in > use before saving the record or would pick the last + 1 value. > > I had many header/detail records end up mixed so I switched to the following > routine: > > Put all the numbers available in a single table with a Y/N flag and have > each user pick the next number from the table by locking the table, grabbing > the number, changing the flag to Y, and unlocking the table. > > All data entry is done through temporary header and detail tables so it > baffles me that I have crossovers and someone's detail records still end up > tacked unto someone else's records. Obviously, the unique header number can > be picked by two users... > > Any ideas to fix this will be greatly appreciated. > > TIA, > > Claudine Robbins > > --- RBASE-L > =======================3D======================= > D= > TO POST A MESSAGE TO ALL MEMBERS: > Send a plain text email to [email protected] > > (Don't use any of these words as your Subject: > INTRO, SUBSCRIBE, UNSUBSCRIBE, SEARCH, > REMOVE, SUSPEND, RESUME, DIGEST, RESEND, HELP) > =======================3D======================= > D= > TO SEE MESSAGE POSTING GUIDELINES: > Send a plain text email to [email protected] In the message SUBJECT, put > just one word: INTRO =======================3D======================= > D= > TO UNSUBSCRIBE: > Send a plain text email to [email protected] In the message SUBJECT, put > just one word: UNSUBSCRIBE =======================3D======================= > D= > TO SEARCH ARCHIVES: > Send a plain text email to [email protected] In the message SUBJECT, put > just one word: SEARCH-n (where n is the number of days). In the message > body, place any text to search for. > =======================3D======================= > D= > > --- RBASE-L > =======================3D=======================3 > D= > TO POST A MESSAGE TO ALL MEMBERS: > Send a plain text email to [email protected] > > (Don't use any of these words as your Subject: > INTRO, SUBSCRIBE, UNSUBSCRIBE, SEARCH, > REMOVE, SUSPEND, RESUME, DIGEST, RESEND, HELP) > =======================3D=======================3 > D= > TO SEE MESSAGE POSTING GUIDELINES: > Send a plain text email to [email protected] > In the message SUBJECT, put just one word: INTRO > =======================3D=======================3 > D= > TO UNSUBSCRIBE: > Send a plain text email to [email protected] > In the message SUBJECT, put just one word: UNSUBSCRIBE > =======================3D=======================3 > D= > TO SEARCH ARCHIVES: > Send a plain text email to [email protected] > In the message SUBJECT, put just one word: SEARCH-n > (where n is the number of days). In the message body, > place any > text to search for. > =======================3D=======================3 > D= > >

