Master detail problem
Posted: Tue 07 Oct 2014 15:25
Hello,
I want to setup master-detail relation between two TSmartQuery components. However my detail query is a join of two tables and unfortunately both of them have col1 column. When I put MasterFields and DetailFields and write my own detail query with parameter I have it rewrited in TCustomDADataSet.GetFinalSQL in a way like SELECT a1.col1, a1.col2, a2.col3 FROM a1, a2 WHERE (a1.col1 = a2.col1 and a1.col1 = :col1) AND COL1 = :COL1
And Oracle throws error because col1 is in both a1 and a2 tables
My question is how can I disable auto generating detail sql. I want to provide my own query.
I see that there is another way to set up master detail relationship in ODAC. Not filling any of MasterFields and DetailFields at all and provide detail query, but when I do that I don't get my detailfields auto populated on new record from master dataset and If I understand documentation I should expect this so maybe it's a bug.
I use 9.4.12, in Delphi XE3
I want to setup master-detail relation between two TSmartQuery components. However my detail query is a join of two tables and unfortunately both of them have col1 column. When I put MasterFields and DetailFields and write my own detail query with parameter I have it rewrited in TCustomDADataSet.GetFinalSQL in a way like SELECT a1.col1, a1.col2, a2.col3 FROM a1, a2 WHERE (a1.col1 = a2.col1 and a1.col1 = :col1) AND COL1 = :COL1
And Oracle throws error because col1 is in both a1 and a2 tables
My question is how can I disable auto generating detail sql. I want to provide my own query.
I see that there is another way to set up master detail relationship in ODAC. Not filling any of MasterFields and DetailFields at all and provide detail query, but when I do that I don't get my detailfields auto populated on new record from master dataset and If I understand documentation I should expect this so maybe it's a bug.
I use 9.4.12, in Delphi XE3