How to limit a Query
I am using Delphi 5 and RB enterprise ... things are going well but I have a
report in which I need to allow the user to set a data range ... how can I
let a start and ending date figure into a query that drives my report? I
guess I could set up a table with a start and ending date that can be set on
before print by the user. I can then link these dates into the query. Is
this the recommended way or is there a better way? Thanks, LL
report in which I need to allow the user to set a data range ... how can I
let a start and ending date figure into a query that drives my report? I
guess I could set up a table with a start and ending date that can be set on
before print by the user. I can then link these dates into the query. Is
this the recommended way or is there a better way? Thanks, LL
This discussion has been closed.
Comments
then open the report?
supplies. I don't see with RB how to insert a variable. LL
It has nothing to do with RB in particular.
Just create a query like:
SELECT ...
WHERE YourDateField BETWEEN :DateIni and :DateEnd
Then set the proper values to the parameters
MyQuery.ParamByName('DateIni').AsDate := TheIniDateSuppliedForTheUser;
MyQuery.ParamByName('DateEnd').AsDate := TheEndDateSuppliedForTheUser;
MyQuery.Open;
MyReport.Print;
code ... for example
if (ppReport1.AutoSearchFields[0].FieldName = 'IncidentDate') then
begin
ppReport1.AutoSearchFields[0].SearchExpression:=LowDate;
ppReport1.AutoSearchFields[1].SearchExpression:=HighDate;
end;
thanks, LL
clause to the underlying Query or filter the data locally?
the WHERE clause is involved. See page 'SQL' in the data designer.
regards,
Chris Ueberall;
:
SELECT *
FROM Table
WHERE
LIMIT 30
then it should limit the output to 30 max
regards Paul
your given statement is database depending and therefore not supported for
all databases.
regards,
Chris Ueberall;
a dialog to query values from the user and then inject them into the query
object.
--
Cheers,
Alexander Kramnik
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com