Subject Re: [IBO] Re: PK field that auto filled with wrong generator value
Author Cipto
For those who try to solve my problem I say thank you. And here I want to
tell you that I already create a separate subject for the same bugs. Because
I think the subject of this thread is not valid again as I future
investigate that the wrong value is come from foreign key value and not from
generator value.

Please to discuss this bugs on the new thread subject that I created. I also
uploaded an example source code to reproduce that bugs, so you will be more
understand what I mean.


----- Original Message -----
From: russellbelding
Sent: Sunday, May 06, 2012 3:04 PM
Subject: [IBO] Re: PK field that auto filled with wrong generator value

Hello Cipto

I am still a bit puzzled and say again: Perhaps my questions will provoke a
thought to you which brings insight.

D=Detail and M=Master as abbreviations you use?
You show the sql for qrtbBeliD and join to table tbBarang.
When you insert a record to qrtbBeliD the primary key d."id" is given a
value whose source is unknown. In particular you are confident the integer
primary key does not come from generator gentbBeliD.

1. Could you simplify this problem using two similar and simpler tables.
Remove all fields except the primary keys and the linking fields. If the
problem is still present post the simpler details here. If the problem is
not presnt, add more fields till the problem appears.

2. If this were my code I'd use a generator and trigger for both tables and
remove the primary key insertion from the OnPostEvent. Your method "feels"
messy and maybe the event code runs too many times. The code looked correct.

3. I see you are using d."names" not d.names. You have a reason for this.
Then I see you use :"id" . How you you use the :"id"?
(paramByName(??).asInteger := 33)
I don't know if is is safe or legal to use double quotes around parameters.
Could you do a simple experiment? use :MyID (new name and without quotes)
instead and see if the problem goes away?

Kind regards,