Simplicty and flexibility!


Auto increment invoice number on a network


Started by Godfrey
Search
You will need to Sign In to be able to add or comment on the forum!

Auto increment invoice number on a network

hie


i would like to run my invoicing system on a network. i need to auto increment invoice number when the invoicing form is accessed by more than 1 user at the
same time. i tried to use getuneek but it works for a number of invoices and it will repeat old invoice numbers.

is there any other function which works perfectly

DataEase 8x


Written by Godfrey 21/12/16 at 07:02:18

Re:Auto increment invoice number on a network

hi 

I use SetUneek / GetUneek.

Define in a procedure

define temp "i" number .

i := SetUneek("invno.ID", 0 )

In the invoice number field derivation do:

GetUneek("invno.ID" , 1 )

Kind regards

Josef


Written by Josef Vella 21/12/16 at 12:24:20

Re:Re:Auto increment invoice number on a network

This is a long standing problem for Application developers and one that has been addressed many times in DataEase over the years.

Obviously Sequence from is the "normal" way of doing this and hence the functionality of this has changed over the years.

GetUneek() basically work the way Sequence from used to work i.e. the number is taken when you call on the function.

This is OK if the number is collected when you save the invoice, but not a good idea if you collect the number when you start a new record.

With this method you will get holes in your sequence if the user choose to abandon the invoice (not saving).

Sequence From has been scorned by many DE users because it has had trouble but the current version actually work as it "should" where it give you the current available number when you open the record and then change it to the latest available number when you save if someone else has saved a record or more in the meantime.

So the current version of Sequence from will give all current users the same sequence number if they open a new record at the same time but will allocated new numbers as you save.

As some users use the Sequence number in derivations (mostly to make the record more unique as they don't trust Sequence from) it can cause problems.

Another solution to this issue is to use Highest Off and a small "script" to create the invoice number when you save the invoice. 

Adding the following code (ex) to the save action on File menu or your Save button will do the trick (Have to be adapted of course).

This is not OML, but simply functions joined together.

if (InvoiceNr=blank, SetValue("InvoiceNr",highest of InvoiceNrRel InvoiceNr+1),0)+RecordSave()


Written by DataEase 28/12/16 at 12:18:19 Dataease [{8}]FIVE
DG3_ForumList