Click to See Complete Forum and Search --> : Group Selection and NULL parameters


Theodore
February 26th, 2007, 11:42 PM
Hi,

Similar to an earlier problem,

I am trying to extract records which are GROUPed BY a field (Division) and the crystal generated SQL is similar to

SELECT
Extensions."SiteId", Extensions."Division",
SUM (SMDR."Duration"),
SUM (SMDR."Cost"),
COUNT (SMDR."Extension")
FROM
{ oj "SMDR" SMDR INNER JOIN "Extensions" Extensions ON
SMDR."SiteId" = Extensions."SiteId" AND
SMDR."Extension" = Extensions."Extn_No"}
WHERE
SMDR."Date" >= {d '2001-02-27'} AND
SMDR."Date" <= {d '2007-02-27'}
GROUP BY
Extensions."Division"
ORDER BY
Extensions."Division" ASC

So I created a parameter and in the Record Selection formula I put in the following test

and
({Extensions.Division} = uppercase({?Division})
or trim({?Division}) = ""
)

This will generate the report I want, however it takes away the GROUP BY efficiency of the SQL statement. This is annoying as there are > million recs. The SQL returned is

SELECT
Extensions."SiteId", Extensions."Division",
SUM (SMDR."Duration"),
SUM (SMDR."Cost"),
COUNT (SMDR."Extension")
FROM
{ oj "SMDR" SMDR INNER JOIN "Extensions" Extensions ON
SMDR."SiteId" = Extensions."SiteId" AND
SMDR."Extension" = Extensions."Extn_No"}
WHERE
SMDR."Date" >= {d '2001-02-27'} AND
SMDR."Date" <= {d '2007-02-27'}
ORDER BY
Extensions."Division" ASC

Is there anyway to select the records without removing the GROUP BY efficiency?

Thanking you in advance.

Theodore