Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: how to add a list of paramers i SQAL command Post Reply Post New Topic
<< Prev  Page  of 2
Author Message
johnwsun
Senior Member
Senior Member


Joined: 28 May 2008
Location: Australia
Online Status: Offline
Posts: 179
Quote johnwsun Replybullet Posted: 13 May 2013 at 2:24pm
Hi Dell,
 
Sorry for my late response..
1. I fixed the problem because I missed the most out open and close brackets
2. I managed to make the structure you suggested work OK
 
 I found if I put anohter pair of parameters in the reports for dates, the report will prompt to ask you to enter  date even when I opt to use break_Type only;
By the way, am I able to integrate date range, e.g. start date and end date into the break type?
the following is the where clause structure in the SQL command that works, I wish to integrate date (start date, end date):
 
WHERE  (('{?break_type}' = 'CD' and LDTE = DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0))
OR
  ('{?break_type}' = 'CW' and LDTE BETWEEN dateadd(week, datediff(week, 0, (getdate())), 0) AND dateadd(week, datediff(week, 0, (getdate())), 6))
OR
  ('{?break_type}' = 'CM' and LDTE BETWEEN DATEADD(month, datediff(month, 0, (getdate())), 0) AND  convert(datetime, convert(varchar(10), getdate(), 101)))
OR
 ('{?break_type}'='CQ' and LDTE BETWEEN DATEADD(qq, DATEDIFF(qq,0,getdate()), 0) AND  dateadd(dd,-1,dateadd(qq,1,DATEADD(qq, DATEDIFF(qq,0,getdate()), 0))))
OR
('{?break_type}'='CY' and LDTE BETWEEN DATEADD(yy, DATEDIFF(yy,0,getdate()), 0) AND  DATEADD(year, DATEDIFF(year, -1, getdate()), -1))
OR
('{?break_type}'='CFY' and LDTE BETWEEN  cast('01-Jul-' + cast( case when datepart(mm,getdate()) in (7,8,9,10,11,12) then DATEPART(yy,getdate())
             else DATEPART(yy,getdate())-1
               end as varchar) as datetime) AND                       
                              cast('30-Jun-' + cast( case when datepart(mm,getdate()) in (6,7,8,9,10,11,12) then DATEPART(yy,getdate())
                else DATEPART(yy,getdate())+1
               end as varchar) as datetime))
OR
('{?break_type}'='PD' and LDTE = DATEADD(day, DATEDIFF(day, 0, GETDATE()), -1))
OR
('{?break_type}'='PW' and LDTE between DATEADD(wk,DATEDIFF(wk,7,GETDATE()),0) and DATEADD(wk,DATEDIFF(wk,7,GETDATE()),6))
OR
('{?break_type}'='PM' and  LDTE between DATEADD(MONTH, DATEDIFF(MONTH, 0, GETDATE()) - 1, 0) and
 DATEADD(DAY, -(DAY(GETDATE())), GETDATE()))
OR
('{?break_type}'='PQ' and LDTE between dateadd(quarter,datediff(quarter,0,getdate())-1,0) and DateAdd(day, -1, dateadd(qq, DateDiff(qq, 0, GETDATE()), 0)))
OR
('{?break_type}'='PFY' and LDTE  BETWEEN  cast('01-Jul-' + cast( case when datepart(mm,getdate()) in (7,8,9,10,11,12) then DATEPART(yy,getdate())
             else DATEPART(yy,getdate())-2
               end as varchar) as datetime) AND                       
                              cast('30-Jun-' + cast( case when datepart(mm,getdate()) in (6,7,8,9,10,11,12) then DATEPART(yy,getdate())
                else DATEPART(yy,getdate())-1
               end as varchar) as datetime))
OR
('{?break_type}'='PY' and LDTE between DATEADD(yy,-1,DATEADD(yy,DATEDIFF(yy,0,GETDATE()),0)) and DATEADD(ms,-3,DATEADD(yy,0,DATEADD(yy,DATEDIFF(yy,0,GETDATE()),0))))) ....
IP IP Logged
<< Prev  Page  of 2
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum