Skip to Content
0
Jul 24, 2017 at 11:26 AM

Parameters in Crystal Report (without field - just from WHERE clausule)

88 Views

Hi all,

I just started with Crystal Reports. I made some examples with parameters, but I have problem with my own query:

SELECT
T0.[CardName] AS 'Klient',
count(distinct T0.[DocNum]) AS 'Ilo?? ofert',
count(distinct T3.[BaseRef]) AS 'Ilo?? zamówie?',
count(distinct T3.[BaseRef])/cast(count(distinct T0.[DocNum]) as numeric)*100 AS 'Wykorzystanie (%)'
FROM
[dbo].[OQUT] T0
LEFT JOIN [dbo].[QUT1] T1 ON T1.[DocEntry] = T0.[DocEntry]
LEFT JOIN [dbo].[ORDR] T2 ON T2.[DocEntry] = T1.[TrgetEntry]
LEFT JOIN [dbo].[RDR1] T3 ON T3.[DocEntry] = T2.[DocEntry]
WHERE
T0.[DocDate] BETWEEN
CONVERT(date,DATEADD(YEAR, -1, GETDATE()),120) AND CONVERT(date,getdate(),120)
GROUP BY T0.[CardName]


Here in WHERE clausule I have data from last year. I want to change it into parameters (underline parts). But in SELECT clusule I didn't use T0.[DocDate] field (and I can't, becouse I don't want group by this field). So this field isn't in the Crystal's "Chose field dialog boxing". I tried many other things, but nothing works (I always get no data).

How it can be done?