Inserting new record in XDataWebDataset when entity has foreign key.

I have two tables A ( master) and B ( detail) linked by foreign key. B.ID -> A.ID ( column name is the same in both tables)
and I have two XDataWebDataset in my project . One for entity A and one for entity B.
I am using Aurelius.
can you tell me please when I add a new record to dataset B how am i supposed to set the ID field? In B dataset the ID field type is TXDataWedDataset ( table A). I was thinking aurelius will take care of the foreign key fields.

Thank you.

I think i found a solution but would like to get a confirmation that i am doing it right please.
This is an example when the foreign key contains 2 columns: C1 and C2. C1 is string. C2 is integer.
Lets say in the master record C1 = 'ABC' and C2 = 123
Is this correct to assign the data in the ONNEWRECORD event like this:

TJSObject(DETAIL_DATASET.CurrentData)['C1@xdata.ref'] := 'MASTER_TABLE(' + '''' + 'ABC' + '''' + ',123)';

( I understand that i can use some formatting functions here.)

1 Like

Yes, that's correct. That's how you use composite keys with XData, values separated by comma.

Thank you.

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.