Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Date time parameters that keep changing Post Reply Post New Topic
Author Message
Kwirky
Newbie
Newbie
Avatar

Joined: 21 Apr 2010
Online Status: Offline
Posts: 32
Quote Kwirky Replybullet Topic: Date time parameters that keep changing
     Posted: 30 Sep 2010 at 12:53pm
Hi,
How do I create a date time parameter that allows the data to refresh from when the report was last run to the current time?
I am creating a sales report that will be migrated to Crystal Server so that it can be emailed automatically twice a day to managers. They want the data to show sales from when the last report was generated to the current time. The report will be scheduled to run at 12pm (lunchtime) and then again at 5.30pm, so I would need the data from 5.30pm to 12 noon, and then 12 noon to 5.30pm.
I am guessing that I could use dynamic parameters, but I do not know how to use them.
Thanks.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 01 Oct 2010 at 3:47am
you could use a command object and do a select based on the time that the system reports when it is run...since it is being run at set times, just select.
 
IP IP Logged
cmartinez4u
Newbie
Newbie


Joined: 14 Oct 2010
Location: United States
Online Status: Offline
Posts: 1
Quote cmartinez4u Replybullet Posted: 14 Oct 2010 at 4:23am
I use Easy View to run, schedule and email my crystal reports.
Working very well under Win7 (64) for the last year.
IP IP Logged
rvink
Groupie
Groupie
Avatar

Joined: 04 Feb 2008
Location: New Zealand
Online Status: Offline
Posts: 55
Quote rvink Replybullet Posted: 14 Oct 2010 at 12:08pm
Create a date-time parameter which can accept range values and is optional. Then create a formula which selects the data. The parameter can be used when you want to run ad-hoc reports for any given period. When you schedule your report on your Crystal Server, leave the date parameter blank. Since no parameter is entered the formula selects the default periods, depending on the current time.


If HasValue({?Date Parameter}) then
   // parameter has been entered
   {table.datefield} = {?Date Parameter}
else if CStr(CurrentDateTime, "HH:mm") >= "17:30"
   // time is 5:30pm or later, run noon to 5:30pm report
  {table.datefield} >= DateAdd("n", 720, CurrentDate) and
  {table.datefield} < DateAdd("n", 1050, CurrentDate)
else
   // 5:30pm yesterday to noon today
  {table.datefield} >= DateAdd("n", -390, CurrentDate) and
  {table.datefield} < DateAdd("n", 720, CurrentDate)



Then put your formula into the select expert:

{@FilterDate} [and ...]

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