Tips and Tricks
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Tips and Tricks
Message Icon Topic: Comparing two dates in two different tables Post Reply Post New Topic
Author Message
brent21090
Newbie
Newbie


Joined: 20 Apr 2009
Online Status: Offline
Posts: 31
Quote brent21090 Replybullet Topic: Comparing two dates in two different tables
    Posted: 28 May 2009 at 6:50am
I am using a date paramenter in my report and would like to compare two date fields in two different tables.  Not sure if there is a crystal function.
Any help with this would be great.
IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 28 May 2009 at 7:10am
hi
 
depends what you are comparing the date parameter
are you using both the tables in the report ,
where do you want to compare the dates?
 
in record selection formula it will be
 
equal to example below
 
if need to check >= or <= or <> change the comparison operator
 
{table1.datefield} = {?prm_date} and {table2.datefield} = {?prm_date}
 
cheers
Rahul


Edited by rahulwalawalkar - 28 May 2009 at 7:11am
IP IP Logged
brent21090
Newbie
Newbie


Joined: 20 Apr 2009
Online Status: Offline
Posts: 31
Quote brent21090 Replybullet Posted: 28 May 2009 at 7:13am
I am using both tables in the report. Basically a user would enter the date when the report is being run and that value will match it to the date in two different tables. I think I have to write some logic behind it.

Edited by brent21090 - 28 May 2009 at 7:17am
IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 28 May 2009 at 7:25am
Hi the  code should work
 
 
in your record selection formula enter
 
{table1.datefield} = {?prm_date} or  {table2.datefield} = {?prm_date}
 
caution :-
this eturn records if the user entered date exists in any one the  tables
 
 
{table1.datefield} = {?prm_date} and  {table2.datefield} = {?prm_date}
 
caution :-
this return records if the user entered date exists in any both the  tables
 
As I said before you need to tell us what is the report suppose to do once the user enters the date in the date parameter ?
 
cheers
Rahul


Edited by rahulwalawalkar - 28 May 2009 at 7:27am
IP IP Logged
brent21090
Newbie
Newbie


Joined: 20 Apr 2009
Online Status: Offline
Posts: 31
Quote brent21090 Replybullet Posted: 28 May 2009 at 7:36am

Yes it does work.

 
Thxs
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.029 seconds.