TdaSQL editing query = different results
Hi. I am editing the SQL for my report using the TdaSQL object. The query
is inner joined on two tables.
However, I am experiencing different results when I modify the
TdaSQL.SQLText.Text property even if the query text is EXACTLY the same as
what is defined on the "DATA" tab. In fact, I don't even have to make the
query assignment to the SQLText property. As soon as I execute the
TdaSQL.EditSQLAsText code, and then run the report immediately following, I
get odd results. If I don't execute the TdaSQL.EditSQLAsText code, the
report generates as expected. What is TdaSQL.EditSQLAsText code doing to
the report's query that is causing it to generate different results? Again,
I don't even modify the SQLText property after issing the EditSQLAsText
code. Any ideas?
Thanks in advance.
Brian Kennedy
RB Ent 7.03
is inner joined on two tables.
However, I am experiencing different results when I modify the
TdaSQL.SQLText.Text property even if the query text is EXACTLY the same as
what is defined on the "DATA" tab. In fact, I don't even have to make the
query assignment to the SQLText property. As soon as I execute the
TdaSQL.EditSQLAsText code, and then run the report immediately following, I
get odd results. If I don't execute the TdaSQL.EditSQLAsText code, the
report generates as expected. What is TdaSQL.EditSQLAsText code doing to
the report's query that is causing it to generate different results? Again,
I don't even modify the SQLText property after issing the EditSQLAsText
code. Any ideas?
Thanks in advance.
Brian Kennedy
RB Ent 7.03
This discussion has been closed.
Comments
When a query is not linked to a master, the SQL text that you can preview
via the DataView tool windows preview SQL option.
If a Query is linked to a master then special linking SQL is generated. See
the following article for details.
You could also try tracing the DADE plug-in code to see the assignment of
the SQL string to the DataSet object. For example, if you are using ADO, you
could trace the daADO.pas source code for the method
TdaADOQueryDataView.SQLChanged. (All of the plugins work the same way).
There is a line of code like this
FQuery.SQL := SQL.MagicSQLText;
-------------------------------------------
Tech Tip: Linking DataViews
-------------------------------------------
Overview
---------
Linking DataViews in the ReportBuilder Data workspace (DADE), requires that
the detail data be sorted by the linking fields. When DataViews are linked,
DADE generates special linking SQL for the detail DataView. The linking SQL
(Magic SQL) can be viewed by positioning the mouse over the DataView window
and pressing Ctrl + Left Mouse button. The results of the Magic SQL query
can be viewed by pressing Shift + Left Mouse button.
ReportBuilder's DataPipeline architecture includes support for linked data
traversal. Whenver the record position of the master data changes, the
traversal logic compares the master and detail field link values and then
determines where to locate the record position for the related detail data.
The linking logic will only work properly if the Database engine's collation
of the detail query result set is in sync with ReportBuilder's internaly
field link comparison logic.
--
Nard Moseley
Digital Metaphors Corporation
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Thank you very much...that helped.
Brian Kennedy
I did as you said and still get the same results. Below is the code snipet.
Even if I don't assign the "SQLText", the error still occurs. All I have to
do is issue the "aSQL.EditSQLAsText=True" and that creates the problem all
by itself. I have traced the problem to that line of code by commenting the
others out. Thanks in advance.
lSQLText := TStringList.Create;
aSQL.EditSQLAsText := True; (<-- As a test, I commented out each line
after this and the problem still occurred)
lDataView.OutOfSync;
lSQLText.Text := strCustomSQL;
aSQL.SQLText := lSQLText;
lSQLText.Free;
Brian Kennedy
RB Ent 7.03
Brian K.