Doug, Didn't know about NEXT. I learned something new today. What's NEXT :)
Jan -----Original Message----- From: "Dan Goldberg" <[email protected]> To: [email protected] (RBASE-L Mailing List) Date: Tue, 25 Jun 2013 13:33:37 -0700 Subject: [RBASE-L] - Re: Assigning Invoice Numbers > I just use the next function with autonum on the column. It will grab > and > increment the next number. > > > From Help: > > (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: Les Stark > Sent: Tuesday, June 25, 2013 10:32 AM > To: RBASE-L Mailing List > Subject: [RBASE-L] - Assigning Invoice Numbers > > I am having a problem with duplicate invoice numbers. > I have a table INVNUM with a column INVNBR that holds an integer > value for the invoice number. > When I create a new invoice, SET VAR VINV#=INVNBR IN INVNUM to > get > the last invoice number from the table > then I increment that number SET VAR VINV#=(.VINVNBR + > 1) the incremented number is used for the current invoice > then I update the table UPDATE INVNUM SET > INVNBR=.VINV# > > The table is ready for the next new invoice and the current invoice > is written with the value of VINV# > This is a multiple user database and is using Row Locks, Column Verify > on the tables > How am I getting duplicate invoice numbers? > Is there a better way to assign Invoice Numbers? > > > -- > >

