What is the best way of making a sequence?
What is the best way of making a sequence?
Quick question: In one of the LE9 application, I wanted to generate a 5 digit sequence number on a network with multiple users. What is the safest way to do this? so we don't duplicate or even skip numbers
Re:What is the best way of making a sequence?
Obviously the standard Sequence field but if it was that simple I guess you wouldn't have asked.
There has been a lot of "fixes" to the Sequence field (sequnce from 00001) over the years and confidence in the functionality have taken a beating.
We use it all the time but mostly just to get a "unique" ID for reference in lookups etc, rather than a completely guaranteed squence.
In the attached sample we "discuss" some ideas and ways to do it and we also showcase how you can use ExecDQL both as a function, inline and in a combination.
The sample is just for ideas and inspiration and you have to finish off how you want to use it yourself based on what is important.
We have a simple example that simply pick the Sequence from a table on load and update the value back immediately. This will make holes in the sequence if you don't store but you will never get two records with the same sequence.
We have one sample that use highest of in an execdql and update on save and another that use the sequencestore table as the first but run a ExecDQL "function" and update on Save again after having picked a "temporary" sequence on load.
Have a go and use it as you please.
One thing I don't understand, why you even need the data-entry values?
define "newnumber" number .
for SequenceStore with Name = data-entry field1 and data-entry field2 not = "yes" ;
newNumber := CurrentNumber + Increment .
modify records
CurrentNumber := newNumber .
list records
newNumber .
meaning this >>> with Name = data-entry field1 and data-entry field2 not = "yes" ;
Re:One thing I don't understand, why you even need the data-entry values?
old good de 4.53 db with sequence from 1 got strange behaviour in table view and the keyboard tricks of fujitsu siemens laptop / thx for emergency aid nevertheless. Glory to DataEase team!