James Bott wrote:Silvio,
Regarding your screenshots of new record data entry screens with IDs, have you tried to figure out what happens if you cancel. Can you cancel one, then add another and see if the second one gets the ID of the cancelled one, a new ID, or?
Are you aware of the concept of voiding? The record is left intact but marked "void" and it is never deleted. This is common practice with accounting software here. I wonder if new records that are canceled are saved in the file and just voided? Maybe you could try this on your demo.
this morning I tried to do what you asked me
I used the software Idea program
I entered a new customer (the code is visible on the screen) on a PC
I put a new customer on another computer
then I canceled the insertion on the first one and also on the second pc
I went to check the client archive from dos and saw that there is no record in the archive
then I open new the software and add new record and th enumber is that I try to add before..
that is, what I want James to understand is this:
the error is right in the Tautoincremental class
when entering a new customer, the append () method of Tautoincremental is called
if oSys: found () // if .t. DBF filename was found in the system file
nID: = oSys: id + 1 // increment the key field value by 1
if the saving is canceled by the user there must be another method which cancels the counter, ie it opens the sysfile file and saves
nId: = oSys: = id-1// decrement the key field value by 1
when a user add a new customer have the real number ( no lose any numbers)
is it possible to make it ?
I sad to my customer "the ID displayed is not reliable and could be changed when the cust record is saved."
because I don't have to lose the number if the progressive number I deduce from the last of the same table +1
without using sysdbf.file and autoincremental class
sample:
at init
IF nMode == 1 .or. nMode == 3 // add new or duplicate
oCust: gobottom ()
CCLI: = StrZero (Val (oCust: NumCli) +1.4)
else
cCli: = oRec: numcli // modify
endif
dialog
@ 12, 5 SAY "Code:" OF oDlg SIZE 19, 8 PIXEL
@ 10, 36 GET aGet [1] VAR cCli OF oDlg SIZE 25, 10 PIXEL READONLY
before to save
If nMode == 1 .or. nMode == 3 // add new or duplicate
If oCust: seek (cCli)
oCust: gobottom ()
CCLI: = StrZero (Val (oCust: NumCli) +1.4)
endif
endif
Oreč: NumCli: = CCLI
Oreč: save ()
in this way I should not lose any number if I cancel the save
if instead I use an external file I lost the number
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 59 guests