Master/Detail Relationship Fieldbyname is null

I'm evaluating your product and am trying to set up a master/detail relationship. The detail table I'm using is the detail table for many tables (address table) therefore it has no foreign key to the master, but it does have a field that references the master (ie. matches one in the master table).

Master Table = CFSA_OFFICE
PRIMARY KEY = CFSA_ID
TORACLEDATASOURCE = Q_CFSA

Detail Table = ADDRESS_TABLE
PRIMARY KEY = ACCOUNT
TORACLEDATASOURCE = T_ADDRESS

I'm using 2 toracle datasets. On the master table I just set it up normally. On the detail table, I set the master field = q_cfsa. In the masterfields table I put the primary key field of the master table (cfsa_id).

My sql code in the detail toracledataset is;

SELECT ADDRESS_TABLE.ROWID,ADDRESS_TABLE.*
FROM ADDRESS_TABLE
WHERE ACCOUNT = :CFSA_ID AND
ACCOUNT_TYPE = 'CFSA'

The problem is, that the value of the account field is null when the insert occurs. In fact, several other fields in the master table is null. What am I doing wrong? I like your product, but this has me stumped.
 
I'm not clear about your tables and key columns, so let's assume you have a master dataset with an "id" field, and a detail dataset with a "master_id" field. The setup would go like this:
  • Add a where clause to the detail dataset: "where master_id = :master_id".
    NOTE: The name of the variable and field must be the same!
  • Set the DetailFields property of the detail dataset to "master_id".
  • Set the MasterFields property of the detail dataset to "id".
  • Set the Master property of the detail dataset to the master dataset.
This is what the automatic master/detail setup does if you have a foreign key constraint.

I hope this helps.

------------------
Marco Kalter
Allround Automations
 
Thanks for the speedy reply. I'm converting my forms today, but can't do the master/details until I get this resolved. The detail table (address_table) has a master detail relationship with the master table, but there is no foreign key. The reason being, is that the address_table is the detail to multiple tables. I enforce the relationship through other ways (triggers etc.). The problem is that when the detail table (address_table) starts to post, the related fields have no data in them. I've actually queried the data in the fields using the fieldbyname function pointing at the master table and the field is blank. I even tried saving the master table first, then coming back and saving the detail, but it's still blank. Weird. I'm sure it's something small I'm missing.
 
Back
Top