Solved

Scheduling a Crystal Report with Windows Scheduler/Task

Posted on 2011-02-28
7
604 Views
Last Modified: 2012-05-11
Good morning.  I had a quick question, which I am not sure if it is possible.  I have a crystal report that I want to run via windows scheduled tasks.  However, I want this to report on the Previous Busines day.  For example, if today is a Tuesday, I want it to report on Mondays data. If today is Monday, I want it to report on Fridays Data.

I want to throw this into a windows task and just let it run each day.  What Im guessing is that I can use some formula in the crystla report to select the previous business day but I am not sure how to do it.  Any help would be appreciated.
0
Comment
Question by:nm67304
7 Comments
 
LVL 77

Assisted Solution

by:peter57r
peter57r earned 250 total points
ID: 34996754
Just working on a fixed monday to friday week then you could use a record selection rule of..

numbervar dw:=dayofweek(currentdate);
datevar testdate:=currentdate-1;
if dw = 2 then testdate:=testdate-2; //prev friday
{table.datefield} = testdate

If course if you have other non-working days except weekends then your formula would have to be extended to deal with those as well.

But, if you have a lot of data then this will probably be slow because the selection rule cannot be pased to the database server, so all records will be returned to CR which will then do the selection.
If there is a lot of data, then it might be worth building a query in the database to return fewer records, or using a SQL command as the report data source instead of a table.   (If you have less than say 5000 records it is probably not worth the effort.)


You could use a command something like...

Select * from table where datefield > <currentdate> - 4

in this case <currentdate> needs to be expressed in the SQL of your database to give you the current date.

This would eliminate all records from over 4 days ago from the database 'fetch' process and CR can then deal with its own records selection rule tfor the final selection.





0
 

Author Comment

by:nm67304
ID: 35006325
Peter57r, thanks for your help.
The next portion of this would be to have a Windows Task set up to export the data from crystal.  We now have crystal reports pulling data from previous day excluding weeknds.  However, I need to figure out how to run this report and export it via windows scheduler.  This is probably done via vb script.
Any ideas?
0
 
LVL 77

Expert Comment

by:peter57r
ID: 35007161
Sorry; can't help with that.  Opening the report might be straightforward but I suspect that automating the export will involve quite a lot of work.

I suggest you post a new question so that it is looked at by everyone.
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
LVL 22

Accepted Solution

by:
Ido Millet earned 250 total points
ID: 35044211
See list of 3rd-part Crystal Reports scheduler at http://www.kenhamady.com/bookmarks.html
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 35321857
This question has been classified as abandoned and is being closed as part of the Cleanup Program. See my comment at the end of the question for more details.
0
 
LVL 18

Expert Comment

by:vasto
ID: 36285099
Ken Hamady has an article about schedulers here:
http://kenhamady.com/cru/comparisons/desktop-scheduling-engines
Feature matrix pdf is available from this link :
http://kenhamady.com/desktopscheduler2011.pdf
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question