Board index » jbuilder » Master detail adding unwanted records

Master detail adding unwanted records


2003-09-05 03:22:36 PM
jbuilder4
Hi,
I have three tables, Customer, CustomerModules and Modules.
I set Customer as my Master datset.
I set CustomerModules as my detail dataset.
I set Modules as a picklist dataset for my detail dataset (CustomerModules just contains the ID of the module).
My first Customer has 2 CustomerModules attached and the second customer has none.
When I navigate between customers, the details show up correctly. So far so good.
This all seems to work fine until:
1. I select the first customer, the 2 details show.
2. I select the first detail. In there I select the picklist field.
3. I doubleclick the field, and the picklist appears.
4. I select the same Module in the picklist (so I don't change anything in fact). The combobox still has the focus.
5. I click on the second CustomerModule
6. I select the 2nd Customer.
7. I see that a new detail for the 2nd customer has been added with the same module as I selected in step 4. ??? Any idea why???
Some peculiarities though:
When between step 4 and 5, I first click on an other field in the same detail record (this makes the picklist CellEditor stopEditing), the record does not get added. ???
I tried to track down the events, and 1 peculiar thing I noticed (which perhaps may be the cause of this) is :
1. When I switch row in the detail records, the navigated event gets triggered (this is normal).
2. When I change the picklist field and immediately after I click on an other detail record, strangely enough the MasterNavigating and MasterNavigated event of the detail set gets triggered. As if I selected an other Customer. Anyone an explanation for this?
Thanks,
Michel.
 
 

Re:Master detail adding unwanted records

Michel Verbist wrote:
Quote

Hi,

I have three tables, Customer, CustomerModules and Modules.
I set Customer as my Master datset.
I set CustomerModules as my detail dataset.
I set Modules as a picklist dataset for my detail dataset (CustomerModules
just contains the ID of the module).

My first Customer has 2 CustomerModules attached and the second customer
has none. When I navigate between customers, the details show up
correctly. So far so good.

This all seems to work fine until:
1. I select the first customer, the 2 details show.
2. I select the first detail. In there I select the picklist field.
3. I doubleclick the field, and the picklist appears.
4. I select the same Module in the picklist (so I don't change anything in
fact). The combobox still has the focus. 5. I click on the second
CustomerModule 6. I select the 2nd Customer.
7. I see that a new detail for the 2nd customer has been added with the
same module as I selected in step 4. ??? Any idea why???

Not sure but do both detail Tables have a foreign key that references the
primary key of the master Table?
 

Re:Master detail adding unwanted records

No they don't.
It's more like a many-many relationship between Customer and Modules with CustomerModules as a link table between them.
There is a one-to-many relation between Customer and CustomerModules, and there is a one-to-many relationship between Module and CustomerModules.
1 Customer has (is entitled to) 1 or more Modules.
1 Modules belongs to (can be bought by) 1 or many Customers.
Michel
pNichols < XXXX@XXXXX.COM >wrote:
Quote
Michel Verbist wrote:

>
>Hi,
>
>I have three tables, Customer, CustomerModules and Modules.
>I set Customer as my Master datset.
>I set CustomerModules as my detail dataset.
>I set Modules as a picklist dataset for my detail dataset (CustomerModules
>just contains the ID of the module).
>
>My first Customer has 2 CustomerModules attached and the second customer
>has none. When I navigate between customers, the details show up
>correctly. So far so good.
>
>This all seems to work fine until:
>1. I select the first customer, the 2 details show.
>2. I select the first detail. In there I select the picklist field.
>3. I doubleclick the field, and the picklist appears.
>4. I select the same Module in the picklist (so I don't change anything in
>fact). The combobox still has the focus. 5. I click on the second
>CustomerModule 6. I select the 2nd Customer.
>7. I see that a new detail for the 2nd customer has been added with the
>same module as I selected in step 4. ??? Any idea why???
>
Not sure but do both detail Tables have a foreign key that references the
primary key of the master Table?
 

{smallsort}