Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Reporting Multiple Dates Post Reply Post New Topic
Author Message
bb2001
Newbie
Newbie


Joined: 24 Nov 2009
Online Status: Offline
Posts: 3
Quote bb2001 Replybullet Topic: Reporting Multiple Dates
     Posted: 24 Nov 2009 at 9:51am
I'm trying to create a report using Crystal 11 based on 5 different date fields. I'm trying to pull data if any one of the five = currentdate.   I can get Date1 = currentdate, or Date2 = currentdate to display, (just one date at a time) but not all 5. Each date field can have data in them, so I want to display them all if one of the dates is equal to today, along with other data like customer name, etc. Any suggestions or formulas that anyone knows to do this?
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 25 Nov 2009 at 6:13am
sounds like you want:
({table1.date1}=currentDate or{table2.date2}= currentDate or{table3.date3}=currentDate or{table4.date4}= currentDate or{table5.date5}=currentDate ) 
 
No, not pretty, but you will need something that return true at some point.
 
HTH
IP IP Logged
bb2001
Newbie
Newbie


Joined: 24 Nov 2009
Online Status: Offline
Posts: 3
Quote bb2001 Replybullet Posted: 25 Nov 2009 at 6:35am
I have tried this and still it will only return one date - whichever I put first in the formula.

I've tried creating a group and parameter value/select criteria with the same results - if {table.date1}=currentdate then 1 else if {table.date2}=currentdate then 2.... {@dategroup}={?dateparm} and selecting all values 1-5 to display.

I've also tried creating separate sub-reports for each date field and linking to the main report (using a cust id that's in all tables) and the report seems to get stuck in a cycle and just keeps refreshing and never displays all records.

I'm pulling the data from a very large oracle db and the date fields are in a couple different tables. Is there possibly a formatting issue that I need to address first?
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 25 Nov 2009 at 7:31am
can these dates be null?  In thinking about it, I remember that DBlank always checks for nulls first...so with that in mind:
local datetime d1 := {table1.date1};
local datetime d2:= {table2.date2};
local datetime d3 := {table3.date3};
local datetime d4 := {table4.date4};
local datetime d5 := {table5.date5};
if isnull(d1) then d1 := "1/1/1900";
if isnull(d2) then d2 := "1/1/1900";
if isnull(d3) then d3 := "1/1/1900";
if isnull(d4) then d4 := "1/1/1900";
 
({d1=currentDate or d2= currentDate or d3 =currentDate or d4= currentDate or d5=currentDate ) 
 
any better?
IP IP Logged
bb2001
Newbie
Newbie


Joined: 24 Nov 2009
Online Status: Offline
Posts: 3
Quote bb2001 Replybullet Posted: 25 Nov 2009 at 8:05am
You got it right! I actually just figured it out myself, there are null values that were throwing it off since I wasn't accounting for them. Thanks for the help.
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