Subject Re: [IBO] insertSQL Help please (again)
Author Daniel Rail
Hi Daniel,

Now, I see your problem and I think Helen, too.

Here's what happens, step-by-step:
1. GeneratorLinks will cause the generator value to increment by one,
on insert.
2. When you Post the data, the InsertSQL is executed, which will
execute the SP NewLocation, but the new value of IDLOC is not passed
to the SP.
3. SP NewLocation executes an INSERT statement, with IDLOC=NULL, since
IDLOC is not passed to the SP and isn't used in the INSERT statement.
4. The trigger is executed. And, since IDLOC is NULL when performing
the INSERT, then the GEN_ID code is executed to retrieve the next
value to assign to IDLOC. And, here is the second generator increment.

And, as you can see, the generator value has been incremented twice
for one INSERT.

You have 2 options:
1. Not use the GeneratorLinks.
2. If you need to know the value of the new IDLOC before it is posted,
then pass IDLOC to the SP and use it in the INSERT.

Hope this helps.

--
Best regards,
Daniel Rail
Senior System Engineer
ACCRA Group Inc. (www.accra.ca)
ACCRA Med Software Inc. (www.filopto.com)