AutoSearch on calc field
Hi,
Does AutoSearch support a calculated field. For example I have the
following:
thisFld := ppReport1.CreateAutoSearchCriteria(reportName, if
(((InvoiceRecon.Code = 0) or (InvoiceRecon.Code IS NULL)) then False else
True),'==', 'True', False);
but all records shwo regardless.
RB6.03
Regards
Alex
Does AutoSearch support a calculated field. For example I have the
following:
thisFld := ppReport1.CreateAutoSearchCriteria(reportName, if
(((InvoiceRecon.Code = 0) or (InvoiceRecon.Code IS NULL)) then False else
True),'==', 'True', False);
but all records shwo regardless.
RB6.03
Regards
Alex
This discussion has been closed.
Comments
I'm not sure, at runtime I simply load a pre-defined report (stord in
rbItems), and pass what I need to it, and then execute ie the end-user
facility.
Alex
No, that syntax is not supported. for the CreateAutoSearchCriteria call. As
described in the online help the first parameters is the datapipeline name
and the second is the field name.
Try using the Query Designer to create calculated fields for the select
clause of the SQL query. Check your database documentation for what types of
expressions are supported.
--
Nard Moseley
Digital Metaphors
http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
I can't use the query designer, as I have a UI that raps around and it is
from here where the user chooses whether to view items that are True or
False. So I need to somehow pass the value over to the pre-defined report.
How is this possible?
Regards
Alex
Are you using TdaSQL and the TdaQueryDataView???
--
Nard Moseley
Digital Metaphors
http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
To be more clear I should have asked whether the Data workspace of the
Report Designer was used to create the query(s) for the report. If you are
loading the report from the rbItems table, then I will assume that this is
the case.
For background information on the ReportBuidler SQL DataView architecture,
please see the articles in the DADE thread of the tech tips newsgroup.
The following example shows how to extract the TdaSQL object from the
DataView and modify it>
http://www.digital-metaphors.com/tips/ExtractSQLObject.zip
You could use the Report.Template.OnLoadEnd to modify the SQL for the
report.
--
Nard Moseley
Digital Metaphors
http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
I have modified the example to do the following (in the LoadEndEvent area):
for i := 1 to selcount do begin
liIndex := lFields.IndexOf(selfield[i]);
if (liIndex <> -1) then begin
lCriteria := aSQL.SelectCriteria(liIndex);
lCriteria.Operator := OpCalc(selOp[i]);
lCriteria.Value := selValue[i];
end;
end;
I still can't see how I can set criteria on a calculated field. In the
above example (basically taken from your example), the liIndex will be -1
for a calculated field, so the criteria will never be created. How can I go
about setting criteria on a calculated field?
Regards
Alex
Try using the TdaSQL.AvailableCriteria[] field list which contains the
available fields from the selected tables plus the calc fields. (The TdaSQL
object has separate arrays for SelectFields and CalcFields that represent
the selected fields and the calculated fields. Do no use these).
--
Nard Moseley
Digital Metaphors
http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com