Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Multiple Date Colums Post Reply Post New Topic
Author Message
dariusd13
Newbie
Newbie


Joined: 16 Jan 2012
Location: United States
Online Status: Offline
Posts: 3
Quote dariusd13 Replybullet Topic: Multiple Date Colums
     Posted: 19 Jan 2012 at 11:40am
I am new to Crystal Reports and I am trying to gather the same data for different months. I need multiple column date filters or prompts to compare changes between two periods. Can anyone tell me how to do this?
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 23 Jan 2012 at 6:52am
If you're looking for changes in numbers over time for a period of consecutive months, I would look at using a cross-tab.  You then just filter for start date and end date.
 
If you're looking to compare two specified months, here's a thought on how to do this:
 
1.  You'll need two copies of the table that is filtered by month - when you select it a second time in the Database Expert, Crystal will alert you that the table is already in the report and ask if you want to alias it.  When you click on Yes (OK?) the table will appear in the selected tables list with "_1" on the end of the table name.  For this example, I will call these "DateTable" and "DateTable_1". 
 
2.  If you have a master table that contains data that is common to both sets, left join both copies of the table to that.  If you don't, left join from DateTable to DateTable_1 - in this case you won't be able to see any data that's in DateTable_1 that doesn't have a corresponding record in DateTable.
 
3.  Create two parameters - I'll call them {?Month1} and {?Month2}
 
4.  In the Select Expert filter on the date field from DataTable = {?Month1} and the date field from DataTable_1 = {?Month2}
 
5.  If you have a master table, group on some field in the master table.
 
This should get you started.  Good luck!
 
-Dell
IP IP Logged
dariusd13
Newbie
Newbie


Joined: 16 Jan 2012
Location: United States
Online Status: Offline
Posts: 3
Quote dariusd13 Replybullet Posted: 24 Jan 2012 at 11:10am
In response to your answer which I appreciate very much. Is it that the only way to make these date ranges work by month and by year,(Which I forgot to mention), to use these formulas below and how do I use them? Do I put them as formulas for the select to find and how do I write the select comand for the prompt? I am so new at this I feel like a newborn child. Thanks in advance for your help. (See Below)

Range Values, v7 - v10:
This simple technique works in either version.   The three examples show how to deal with ranges using date, numeric and character data types, respectively.   Look in the Crystal help for help using ToText() to control numeric or date formats
.

"From: " &   Minimum ( {?Date Range} ) &
" To: "    &    Maximum ( {?Date Range} )


"From: " & ToText ( Minimum ( {?Number Range} ) , 0 , "" ) &
" To: "    & ToText ( Maximum ( {?Number Range} ) , 0 , "" )


"From: " & Minimum ( {?String Range} )   &
" To: "    & Maximum ( {?String Range} )

A more sophisticated example for DATE parameters takes into account the options for "no lower/upper bound":
if Minimum ( {?Date Range} ) = Date (0,0,0)
then "All Dates through " & Maximum ( {?Date Range} )
else
if Maximum ( {?Date Range} )= Date (0,0,0)
then "From " & Minimum ( {?Date Range} ) & " Forward"
else
"From: " & Minimum ( {?Date Range} ) &
" To: "    & Maximum ( {?Date Range} )
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