The Query Designer does not allow a function to be specified in the SQL where clause. The TdaSQLBuilder class can be used to programmatically modify the SQL in the same manner as the query designer. For example you can use it add/modify search criteria. Therefore you can use Delphi code or RAP code to modify the search criteria to include the current date.
See the TdaSQLBuilder topic in the online help and from there traverse to the subtopics for search criteria - there is example code in the help.
Best regards,
Nard Moseley Digital Metaphors www.digital-metaphors.com
Here is an example that I created in RAP code. I used the Report.BeforeOpenDataPipelines event. This example works in paradox. Depending upon what database engine you are using, you might need to format the date string differently.
For RB 9 we introduced two new events: Report.OnInitializeParameters and Report.BeforeOpenDataPipelines and the new TdaSQLBuilder class. The goal was to enable RAP code to be used to create/initialize parameters (including AutoSearch parameters) and to use RAP code to modify the SQL associated with a dataview.
RB 7 does not include the ability to do what you describe. You might consider updating to RB 10, if at all possible.
Best regards,
Nard Moseley Digital Metaphors www.digital-metaphors.com
Comments
The Query Designer does not allow a function to be specified in the SQL
where clause.
The TdaSQLBuilder class can be used to programmatically modify the SQL in
the same manner as the query designer. For example you can use it add/modify
search criteria. Therefore you can use Delphi code or RAP code to modify the
search criteria to include the current date.
See the TdaSQLBuilder topic in the online help and from there traverse to
the subtopics for search criteria - there is example code in the help.
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Thanks for that...
Can you send me an example RTM file that shows how to do just this in RAP ??
I have an End User Report Solution already used globally and would rather
issue an RTM then a new EXE.
Cheers
Mark
Here is an example that I created in RAP code. I used the
Report.BeforeOpenDataPipelines event. This example works in paradox.
Depending upon what database engine you are using, you might need to format
the date string differently.
var
lSQLBuilder: TdaSQLBuilder;
begin
lSQLBuilder := TdaSQLBuilder.Create(Customer);
lSQLBuilder.SearchCriteria.Add('Customer', 'LastInvoiceDate', '=',
DateToStr(CurrentDate));
lSQLBuilder.Free;
end;
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Thanks for that, however I do not seem to have that event
"BeforeOpenDataPipelines"
I should point out that I am currently using version 7.04
Cheers
Mark
For RB 9 we introduced two new events: Report.OnInitializeParameters and
Report.BeforeOpenDataPipelines and the new TdaSQLBuilder class. The goal was
to enable RAP code to be used to create/initialize parameters (including
AutoSearch parameters) and to use RAP code to modify the SQL associated with
a dataview.
RB 7 does not include the ability to do what you describe. You might
consider updating to RB 10, if at all possible.
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Yes.
RB 10 includes support for D6, D7, D2005, and D2006
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com