Print Page | Close Window

Passing date option parameter in command object

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=6297
Printed Date: 05 May 2024 at 4:26am


Topic: Passing date option parameter in command object
Posted By: vtcollins
Subject: Passing date option parameter in command object
Date Posted: 08 May 2009 at 8:47am
I am converting a Crystal 10 report to Crystal 2008. The report uses a command object. THe report has a paramter that allows the user to select for example last full month. In 2008 I am getting a error message that I have a data type mismatch between the then/else statement. Can someone help with this issue?
This is the code I am using.
 
CASE
  WHEN '{?Date Range Option}'= 'Last Full Week'  
   THEN (cal.calendar_date - cal.day_of_week- 6)
  WHEN '{?Date Range Option}'= 'Last Full Month'  
   THEN ADD_MONTHS((cal.calendar_date - cal.day_of_month)+1,-1)
  WHEN '{?Date Range Option}'= 'Custom Date Range'
   THEN {?Start DATE}
  ELSE cal.calendar_date
 END  AS startDate,
 CASE 
  WHEN '{?Date Range Option}'= 'Last Full Week'  
   THEN  (cal.calendar_date - cal.day_of_week)
  WHEN '{?Date Range Option}'= 'Last Full Month'  
   THEN  (cal.calendar_date - cal.day_of_month)
  WHEN '{?Date Range Option}'= 'Custom Date Range'
   THEN {?End DATE}
  ELSE cal.calendar_date
 END AS endDate,


-------------
HCConsultant



Replies:
Posted By: lockwelle
Date Posted: 11 May 2009 at 6:52am
I would try commenting out when/then combinations.  they all need to return the same datatype, which would appear to be a datetime.
 
The other would be take expression and run it in sql and see if it give you a better description of the error, if any.



Print Page | Close Window