Joined: 14 May 2007
Location: India
Online Status: Offline
Posts: 10
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
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
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...
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