Also, note in this context you can have gaps in the invoice number if the users 
does not complete the 
invoice and abandons it.

Does your policy require no gaps in invoice numbers? 
If it does consider using an AUTO NUMBER column along with an AFTER INSERT 
STORED PROCEDURE 
that report back the invoice number to the data entry function.
 

Jim Bentley,
American Celiac Society
1-504-737-3293


________________________________
 From: Dan Goldberg <[email protected]>
To: RBASE-L Mailing List <[email protected]> 
Sent: Tuesday, June 25, 2013 3:33 PM
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?


--  

Reply via email to