Skip to Content
0
Former Member
Oct 20, 2008 at 08:26 PM

CR 9.0 component behavior

23 Views

I have for some time some Delphi applications where I use the TCRPE component to generate reports.

I design the reports with 2 datetime parameters used in the record selection for limiting the resultset:

MyDatetimeField between ?startDatetime and ?endDatetime

I can see this record selection condition in the Show SQL query.

Also, for some reports I add in the SQL query some more restrictions, usually more complicated. For this I retrieve the CRPE.SQL stringlist and I insert in it the desired SQL condition.

I just find out that at runtime the reports do not use for the SQL select query the Datetimes restriction. It applies it only to the resultset, which can be pretty large.

As an example:

In Show SQL query at design time I can see like:

 SELECT "Jobs"."nJobNumber", "Jobs"."nJobLen", "Jobs"."dtDictEnd", "Jobs"."cFacilityID", "Jobs"."cFacilityName"
 FROM   "Jobs" "Jobs"
 WHERE  ("Jobs"."dtDictEnd">={ts '2008-10-20 16:20:11'} AND "Jobs"."dtDictEnd"<{ts '2008-10-20 16:20:12'})
 ORDER BY "Jobs"."cFacilityID"

At run time I add another condition ( AND (Jobs.nJobLen>0) )

and I was expecting to have something like:

SELECT "Jobs"."nJobNumber", "Jobs"."nJobLen", "Jobs"."dtDictEnd", "Jobs"."cFacilityID", "Jobs"."cFacilityName"
 FROM   "Jobs" "Jobs"
 WHERE  ("Jobs"."dtDictEnd">={ts '2008-10-20 16:20:11'} AND "Jobs"."dtDictEnd"<{ts '2008-10-20 16:20:12'})
AND ("Jobs"."nJobLen">0)
 ORDER BY "Jobs"."cFacilityID"

But the runtime SQL query shows only:

SELECT "Jobs"."nJobNumber", "Jobs"."nJobLen", "Jobs"."dtDictEnd", "Jobs"."cFacilityID", "Jobs"."cFacilityName"
 FROM   "Jobs" "Jobs"
 WHERE  ("Jobs"."nJobLen">0)
 ORDER BY "Jobs"."cFacilityID"

Is this the normal behavior?

What can I do to have both condition applied?

(The condition used in example is very simple, but I have something more complicated which cannot be implemented using parameters).

Thanks,

Ioan