Print Page | Close Window

Schedule a single report multiple times in BOE XI

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=1467
Printed Date: 04 May 2024 at 9:37am


Topic: Schedule a single report multiple times in BOE XI
Posted By: Iago
Subject: Schedule a single report multiple times in BOE XI
Date Posted: 08 Oct 2007 at 11:28am

The last two jobs I have had have the same issue.

 

Once a report is created and Published to Crystal Reports Server or Business Objects Enterprise XI r2, how do I schedule that report for each client ID.  The report takes a Parameter of a Client ID.  I can run the report locally using C# and the ReportDocument class.  I want to created schedule objects on the Enterprise server for each client.  There may be a few hundred client IDs.  The cruel solution is to have a business user create all the schedules via infoview.  I can generate a collection of Client IDs in C# with much work.  I hope Mr. Bischof has a chapter or two on this subject in his next book.  A very common business requirement is to have the same report sent to all of our clients and have each report contain only that clients data.  Invoices for example.




Replies:
Posted By: IdoMillet
Date Posted: 26 Oct 2007 at 5:16pm
Consider a 3rd-party tool as a solution (for a list of such tools, see http://www.kenhamady.com/bookmarks.html).

This is called report "bursting." My Visual CUT software provides this type of functionality.

- Ido





-------------
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
www.MilletSoftware.com


Posted By: Iago
Date Posted: 29 Oct 2007 at 6:57am
Thanks, but that product looks like a visual interface around the reportDocument class in the Crystal Reports.  I can see where it would be useful, but that is basically my existing solution.  My solution enables me to query a table for information on a client and use that recordset to feed the reportdocument object I create.   Brian's older book has some great information on the subject.  I am looking forward to his book in December.  However all of that work uses the Crystal Reports SDK and not the Enterprise SDK.  With the BO Enterprise product, I get such advantages, such as report history and a log of what happened on the Audit database.  Also the business user can then change an existing schedule, that is if they wish to hang themselves.
 
A few people have suggested somethink like what you suggested, I wish to leverage our existing investment as much as possible.
Thanks


Posted By: Iago
Date Posted: 29 Oct 2007 at 7:10am

SqlConnection conn = new SqlConnection(conString);

ReportDocument MyReport = new ReportDocument();

try

{

conn.Open();

SqlCommand cmd = new SqlCommand(sqlQuery, conn);

SqlDataReader reader = cmd.ExecuteReader();

int i = 0;

Boolean[] emailsent = new Boolean[1000];

for (int x = 1; x < 1000; x++)

{ emailsent[x] = false; }

while (reader.Read())

{

if (reader["notify_event"].ToString()== "ANNC" )

{

i++;

Console.WriteLine(i + " " + reader["sec_no"].ToString() + " " + reader[2].ToString() + " " + reader[3].ToString() + " " + reader["sub_no"].ToString()

+ " " + reader["add_cymd"].ToString() );

MyReport.Load(@"\\lgc-oma-rpt\reports\NOTSNOTBYSECv2.rpt");

MyReport.SetDatabaseLogon("xxxxxx", "xxxxxx", "lgc-oma-sql", "corpdata");

MyReport.SetParameterValue("sec_no", reader["sec_no"].ToString());

MyReport.SetParameterValue("AddDate", reader["add_cymd"]);

MyReport.SetParameterValue("rep", reader["rep"].ToString());

DestFolder destfolder = new DestFolder();

destfolder.myBaseFldr = @"\\jhill\c$\junk";

destfolder.CreateSubFolder((int)reader["sub_no"], "ANNC");

// Use new DLL here to set tempPDF

tempPDF = destfolder.FolderPath;

PDFReport = tempPDF + @"\" + reader["sub_no"].ToString() + "-" + reader["rep"].ToString() + "-" + reader["sec_no"].ToString() + "-" + i.ToString() +"-NOTS.pdf";

MyReport.ExportToDisk(ExportFormatType.PortableDocFormat, PDFReport);

CCEmail = " ";

if (reader.GetSqlBoolean(5) == true)

{

EmailPDF(reader, PDFReport, FromEmail, reader["NOTS_ToEmail"].ToString(), CCEmail);

emailsent[reader.GetInt32(4)] = true;

}

}

}

CheckForNoEmail(emailsent, FromEmail);

}

catch (Exception ee)

{

Console.WriteLine("error " + ee);

}

conn.Close();

Console.WriteLine("Out of stuff to do for today");



Posted By: IdoMillet
Date Posted: 29 Oct 2007 at 7:15am
There are several significant differences between the approach you are discussing and what Visual CUT does.  For example, Visual CUT doesn't need a list of customers to work against -- it detects the list of customers in the report itself.  It doesn't run the report multiple times -- it burst it in a single pass.  It doesn't need development effort to set various values such as export file names and email options based on values in the report -- you just drag & drop fields & formulas from the report into these options.

Well, I'm getting carried away so I'll stop...  :o)

-------------
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
www.MilletSoftware.com


Posted By: Iago
Date Posted: 29 Oct 2007 at 7:16am
I had a requirement to send an email to all clients that did not get an email today, so I used an Array to keep track of who did not get a report today.   I also needed to store the PDFs in a complex directory structure, so there is a large class not shown called DestFolder.  There is also a method to email the client.  So if you can look past my mess and see the MyReport Object, that is the key.



Print Page | Close Window