Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Date Comparsion Post Reply Post New Topic
Author Message
danasegarane
Newbie
Newbie
Avatar

Joined: 14 May 2007
Location: India
Online Status: Offline
Posts: 10
Quote danasegarane Replybullet Topic: Date Comparsion
     Posted: 03 May 2010 at 11:46pm
Hi am using Date Comparsion in Crystal Report selection Formula as

if (strcmp({?Fromdate},'Nothing')=0 and strcmp({?Todate},'Nothing')=0) then
(
{Command.COMPANYID}={?CompanyId} and
{Command.MODIFIEDDTTM}={Command.MODIFIEDDTTM} and
{Command.CLASSIFICATION} = (if strcmp({?Classification},'Nothing')=0 then {Command.CLASSIFICATION} else {?Classification}) and
{Command.MODIFIEDBY} = (if strcmp({?ModifiedBy},'Nothing')=0 then {Command.MODIFIEDBY} else {?ModifiedBy}) and
{Command.FORMID} = if({?FormId}<> -1) then CDbl({?FormId})else{Command.FORMID}
 
)
else
(
{Command.COMPANYID}={?CompanyId} and
{Command.MODIFIEDDTTM} <= CDateTime({?Todate}) and
{Command.MODIFIEDDTTM} >= CDateTime({?Fromdate}) and
{Command.CLASSIFICATION} = (if strcmp({?Classification},'Nothing')=0 then {Command.CLASSIFICATION} else {?Classification}) and
{Command.MODIFIEDBY} = (if strcmp({?ModifiedBy},'Nothing')=0 then {Command.MODIFIEDBY} else {?ModifiedBy}) and
{Command.FORMID} =  if({?FormId}<> -1) then CDbl({?FormId}) else {Command.FORMID}

)

This formula currently showing records greater than todate. What I am doing wrong

Thanks,

IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 04 May 2010 at 3:24am
are the users entering 'Nothing' for the parameters?  If they are dateTime, I don't think that CR will allow that.  If they are checking the NULL value, then you would want to check if the value is null, like:
 
if ISNULL({?FromDate}) AND ISNULL({?ToDate}) then...
 
HTH
IP IP Logged
danasegarane
Newbie
Newbie
Avatar

Joined: 14 May 2007
Location: India
Online Status: Offline
Posts: 10
Quote danasegarane Replybullet Posted: 04 May 2010 at 3:26am

No I found the issue...

 

Replaced

CDateTime 



with



CDate



This Solved the Issue
IP IP Logged
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