I have used Rick's method for years now for incrementing invoice numbers etc.  
My application lets users enter their own invoice number, but if the enter a 
"#", then it gives them the next number, formatted on a field of zeros and 
preceded with a character represting any of the stores involved.  Same routine 
works for receipts.
 
David Grenfell> Date: Wed, 10 Dec 2008 09:21:54 -0800> Subject: Re: Auto 
Increment?> From: [EMAIL PROTECTED]> To: [email protected]> > > Jim,> > 
Although your solution is better for jBASE 4.1 its not better if your> 
application runs on multiple MV platforms.> > So, you are fired for not 
pointing this out also.> > Rick> > On Dec 9, 2:45 pm, Jim Idle <[EMAIL 
PROTECTED]> wrote:> > On Mon, 2008-12-08 at 15:12 -0800, Rick Weiser wrote:> > 
> Walt,> >> > > No, you must perform this operation programmatically.  Here is 
a> > > simple example:> >> > Walt,> >> > If you are using 4.1 then you can use 
the UNIQUEKEY function:> >> > UNIQUEKEY> > Returns a unique 16-byte character 
key> > COMMAND SYNTAX> > UNIQUEKEY ()> > SYNTAX ELEMENTS> > The UNIQUEKEY() 
function will generate a unique 16-byte character key on> > each call to the 
function.> > The key contains characters from the set A-Z a-z 0-9 + and / 
(base64)> > Based on the current UTC time and the process number, the key is 
unique> > on a single computer system> > providing that the system clock is not 
turned back.> > If the system administrator adjusts the system clock backwards, 
then> > there is a slight possibility of> > generating duplicate keys during 
the period until the clock has caught> > back up to time that the> > adjustment 
was made.> > Any process that continues to execute throughout this period will> 
> continue to produce unique keys.> > A process that starts up during this 
period and is given the process ID> > of a process that terminated> > during 
the period, may possibly generate a duplicate key until the> > period ends.> >> 
> It isn't quite the same as auto increment, so I won't fire Rick (nah, I> > 
will - Rick, you're fired!), but many times this is what you want.> >> > Jim> 
>> >> >> > > OPEN 'MYFILE' TO F.MYFILE ELSE STOP 201,'MYFILE'> >> > > READU 
NEXTID FROM F.MYFILE,'NEXT.ID' ELSE NEXTID = 1> > > RECORD.ID = NEXTID> > > 
NEXTID += 1> > > WRITE NEXTID ON F.MYFILE,'NEXT.ID'> >> > > I hope this helps,> 
>> > > Rick> >> > > On Dec 8, 5:41 pm, ww <[EMAIL PROTECTED]> wrote:> > > > 
Does jBASE have an auto increment feature for new records?> >> > > > Thanks in 
advance,> >> > > > Walt> 
_________________________________________________________________


--~--~---------~--~----~------------~-------~--~----~
Please read the posting guidelines at: 
http://groups.google.com/group/jBASE/web/Posting%20Guidelines

IMPORTANT: Type T24: at the start of the subject line for questions specific to 
Globus/T24

To post, send email to [email protected]
To unsubscribe, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/jBASE?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to