Master Detail New Record Problem

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
alienjohn
Posts: 5
Joined: Tue 30 Mar 2021 16:01
Location: Greece

Master Detail New Record Problem

Post by alienjohn » Fri 25 Mar 2022 07:26

Hello,

i have,

Master Table :
Table Scales with Fields : ID, IDVehicle, IDCustomer, Weight

Secondary Lookup Tables :
Table Vehicles with Fields : ID, LisencePlate
Table VehicleCustomers with Fields : ID, IDVehicle, IDCustomer

I have connected as master detail connection :
VehicleCustomers.MasterSource := dsScales <- DataSource for Table Scales
VehicleCustomers.MasterFields := Scales.IDVehicle
VehicleCustomers.DetailFields := VehicleCustomers.IDVehicle

Vehicle Table is connected to a LookupComboBox to display all vehicles with field IDVehicle from Table Scales
VehicleCustomers Table is connected to a LookupComboBox to display all customers that belongs to this Vehicle with field IDCustomer from Table Scales

User selects a Vehicle from the LookupComboBox and the VehicleCustomers LookupComboBox should list all customers that belong to the selected Vehicle.

When EDITING the Scales record its working as expected.

When INSERTING a new record on Scales, Vehicle LookupComboBox is selecting vehicles but the VehicleCustomers LookupComboBox stays blank, like the releation is not working.

Note that field Scales->IDVehilce on Vehicle LookupComboBox, is changing value when selecting a Vehicle.

I know that the Master ID Field of Master Table Scales is Null, but the Master Table is not connected with a Detail Table (like master->id=detail->id), the connection is only made for the LookupComboBoxes.

Temp solution :
When setting a temp value to Scales Master ID = 0 and temporaly post the record (not commit), then the releation connection is working fine and
the VehicleCustomers LookupComboBox lists all customers that bellongs to this Vehicle.

Any ideas
Thanks
John

pavelpd
Devart Team
Posts: 109
Joined: Thu 06 Jan 2022 14:16

Re: Master Detail New Record Problem

Post by pavelpd » Mon 28 Mar 2022 12:10

Hi

We are unable to reproduce the specified behavior based on the data you have provided.

Therefore, please compose and send us an example demonstrating the problem you mentioned, including all the necessary scripts for creating and populating test database objects, and send it to us via the e-support form: https://www.devart.com/company/contactform.html

Additionally, please specify what database and version are you using?

Post Reply