Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: record selection formula problem Post Reply Post New Topic
Author Message
billbjr
Newbie
Newbie


Joined: 19 Feb 2009
Location: United States
Online Status: Offline
Posts: 14
Quote billbjr Replybullet Topic: record selection formula problem
     Posted: 04 Mar 2009 at 8:57am
I work at a casino that uses CRM software to track the gaming activity for casino patrons. The software tracks the gaming activity by date.
 
I'm trying to identify the players who's last gaming date was between 180 and 187 days ago so we can end them a mailer. In other words, I if I ran the query today (3/4/09) I would want to select all players who had a gaming date between 8/29/08 and 9/5/08, but no gaming days since then.
 
I created a group field that shows "max" of gaming date, and then tried to create a record selection using the following formula:
 
datediff("d",Maximum ({CDS_STATDAY.GamingDate}, {CDS_ACCOUNT.Account_ID}),currentdate)>180 or
datediff("d",Maximum ({CDS_STATDAY.GamingDate}, {CDS_ACCOUNT.Account_ID}),currentdate)<= 187
 
But it doesn't work. it still gives me records of players who had a gaming day from February '09, for example.
 
Any suggestions?


Edited by billbjr - 04 Mar 2009 at 8:58am
Bill
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: 05 Mar 2009 at 4:31am
Hi
 
Hi
 
datediff("d",Maximum ({CDS_STATDAY.GamingDate}, {CDS_ACCOUNT.Account_ID}),currentdate) between 180 to 187
 
 hope that works...... if possible please post some sample data
 
cheers
Rahul
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 05 Mar 2009 at 7:47am
Note the above select statement will exclude all records not in that 7 day date range and therefore not let you know if these people had any dates after that.
IP IP Logged
billbjr
Newbie
Newbie


Joined: 19 Feb 2009
Location: United States
Online Status: Offline
Posts: 14
Quote billbjr Replybullet Posted: 05 Mar 2009 at 7:55am
it turns out that my statement had one word  that was incorrect...it should be "and" instead of "or":
 
datediff("d",Maximum ({CDS_STATDAY.GamingDate}, {CDS_ACCOUNT.Account_ID}),currentdate)>180 and
datediff("d",Maximum ({CDS_STATDAY.GamingDate}, {CDS_ACCOUNT.Account_ID}),currentdate)<= 187
 
After I changed it it worked fine. Thanks again for your help.
Bill
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