COMMIT in onPush

clemboclembo Member Posts: 122
I've a List Job form. In this form there is a button. When user push this button execute this code:

localJob.INIT;
localJob.Template := FALSE;
localJob."Contract Status" := localJob."Contract Status"::"Open";
localJob.INSERT(TRUE);
COMMIT;
CLEAR(VeichleContractCard);
VeichleContractCard.ImpostaFiltro;
VeichleContractCard.SETTABLEVIEW(localJob);
VeichleContractCard.SETRECORD(localJob);
VeichleContractCard.RUNMODAL;


First time that execute code it's work great creating new JOB.
Second time it's shows an error because try to create same Job number.
Why this? I've inserted COMMIT to write transaction. Series increment number correctly but my form don't know this.
How I can solve?

Comments

  • einsTeIn.NETeinsTeIn.NET Member Posts: 1,050
    As you can see in the online help INIT doesn't reset the primary key fields. Try to use CLEAR instead.
    "Money is likewise the greatest chance and the greatest scourge of mankind."
Sign In or Register to comment.