ramkrish11
Programmer
Hello All,
I am new to Crystal Reports and am having trouble understanding the flow that one can build into record selection Formula Editor.
I am using CR XI on Oracle 9.2
I have a DateRange parameter with possible values Daily, Weekly, Monthly. I need to evaluate it in the report and come up with the start date and end date values used in the SQL.
I tried the following in the record selection Formula editor.
---------------------------------------------------------
global datetimevar StartDate;
global datetimevar EndDate;
select {?DateRange}
case "Daily":
StartDate = (currentdate - 1)
case "Weekly":
StartDate = minimum(WeektodateFromSun)
case "Monthly":
if (day(Currentdate)) = 1 then
StartDate = minimum(LastFullMonth)
else
StartDate = minimum(MonthtoDate);
StartDate = Datetime(Datepart(StartDate),timevalue('00:00:00'));
EndDate = Datetime(Datepart(CurrentDate),timevalue('00:00:00'));
//
// use the date fields in the sql below
//
{PAYMENT_REPOSIT.CREDIT_CARD_NUM} in ["nnnnnnnnnnnnn", "nnnnnnnnnnnnnn"] and
{PAYMENT_REPOSIT.CANCEL_IND} = "N" and
({PAYMENT_REPOSIT.EXTRACT_DATE} >= StartDate
and {PAYMENT_REPOSIT.EXTRACT_DATE} < EndDate)
---------------------------------------------------------
I dont quite see how the evaluation of parameter will work with the SQL expression part in the same area. Any explanations or pointers to relevant articles explaning what we can and cannot do (and how to do this ) in the Record Selection formula editor will be of great help.
Greatly appreciate your help
Ram
I am new to Crystal Reports and am having trouble understanding the flow that one can build into record selection Formula Editor.
I am using CR XI on Oracle 9.2
I have a DateRange parameter with possible values Daily, Weekly, Monthly. I need to evaluate it in the report and come up with the start date and end date values used in the SQL.
I tried the following in the record selection Formula editor.
---------------------------------------------------------
global datetimevar StartDate;
global datetimevar EndDate;
select {?DateRange}
case "Daily":
StartDate = (currentdate - 1)
case "Weekly":
StartDate = minimum(WeektodateFromSun)
case "Monthly":
if (day(Currentdate)) = 1 then
StartDate = minimum(LastFullMonth)
else
StartDate = minimum(MonthtoDate);
StartDate = Datetime(Datepart(StartDate),timevalue('00:00:00'));
EndDate = Datetime(Datepart(CurrentDate),timevalue('00:00:00'));
//
// use the date fields in the sql below
//
{PAYMENT_REPOSIT.CREDIT_CARD_NUM} in ["nnnnnnnnnnnnn", "nnnnnnnnnnnnnn"] and
{PAYMENT_REPOSIT.CANCEL_IND} = "N" and
({PAYMENT_REPOSIT.EXTRACT_DATE} >= StartDate
and {PAYMENT_REPOSIT.EXTRACT_DATE} < EndDate)
---------------------------------------------------------
I dont quite see how the evaluation of parameter will work with the SQL expression part in the same area. Any explanations or pointers to relevant articles explaning what we can and cannot do (and how to do this ) in the Record Selection formula editor will be of great help.
Greatly appreciate your help
Ram