473,322 Members | 1,523 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Report Geneartion

I'm developing a CRUD based desktop application and I want to structure the
design so that I don't need to modify the source code to add additional
reports. I'm planning to use the version of Crystal Reports that comes with
VS.Net 2005, but I'm a novice with this tool. Can somebody can give me some
suggestions or point me to some sample code/design?

TIA

Brad
May 18 '07 #1
1 1122

You're basically wanting to create a ReportingFramework ... where you can
dynamically add in new CR's.

First check this out:
12/1/2005
Understanding the Simple Factory Pattern
http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!126.entry
Look especially at "Reflection"
You need to code to house "how am I going to show this report?".

public class ReportViewArgs : System.EventArgs
-- ReportAssembly (string)
--ReportFullyQualifiedObjectName (string)
--SourceDataSet (DataSet)


If you do this, you can create what you want.

HOWEVER, you will need to **abandon** writing reports which talk directly to
the database. (which is a good idea of its own right), and go to a dataset
model.

Read this post:
http://groups.google.com/group/micro...059b979636e53e

Read this article:
http://support.businessobjects.com/c...etdatasets.pdf

Here is your code:

private void Go(ReportViewArgs args)

{
CrystalReport rpt = this.LoadUsingReflectionTheReport (args ) ;
rpt.SetDataSource (args.SourceDataSet);

CrystalReportViewer1.ReportSource = rpt;

}

private CrystalReport LoadUsingReflectionTheReport ( ReportViewArgs args )
{
//use the blog code to figure out how to reflectively create your CR
object.
//http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!126.entry
return rpt;

}

Here is mocked example:
ReportViewArgs : System.EventArgs
-- ReportAssembly (string)
--ReportFullyQualifiedObjectName (string)
--SourceDataSet (DataSet)

ReportViewArgs args = new ReportViewArgs ();
args.ReportAssembly "MyReports";// usually you'll have a file called
MyReports.dll, which is a net assembly with your CR defs in it
args.ReportFullyQualifiedObjectName "MyReports.EmployeeSalariesReports";
//full name of the objects, including namespaces
args.SourceDataSet = DAL.SomeMethodToGetTheDataSet();

//then call it
X.Go (args);

If you want to be able to add in reports later, on the fly, this is a good
architecture.
How do I know? I've already done one of these.

Go with datasets with Crystal Reports. And months later when you decide CR
sucks and you want something else, you still have the datasets, and not a
bunch of hidden CR code that you can't reuse.


"Brad" <br************@roche.comwrote in message
news:eO**************@TK2MSFTNGP02.phx.gbl...
I'm developing a CRUD based desktop application and I want to structure
the
design so that I don't need to modify the source code to add additional
reports. I'm planning to use the version of Crystal Reports that comes
with
VS.Net 2005, but I'm a novice with this tool. Can somebody can give me
some
suggestions or point me to some sample code/design?

TIA

Brad


May 18 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: CSDunn | last post by:
Hello, I have a situation with MS Access 2000 in which I need to display report data in spreadsheet orientation (much like a datasheet view for a form). If you think of the report in terms of what...
1
by: Nathan Bloomfield | last post by:
Does anyone know if there is any documentation which relates to Access2k + ? or can anyone help adjust the code? I am having trouble converting the DAO references. TITLE :INF: How to...
6
by: Bob Alston | last post by:
I am looking for Access reporting add-in that would be easy to use by end users. My key focus is on selection criteria. I am very happy with the Access report writer capabilities. As far as...
1
by: lorirobn | last post by:
Hi, I have a report that works just fine. Now I would like to add the capability to choose selection criteria to limit what is displayed. I created several reports that do this, but they used...
1
by: monskie | last post by:
Hello to all, I have a problem which could be trivial to you guys. This concerns opening several crystal reports on the a crystal viewer on an ASPX page by calling window.open. My...
6
by: Dave | last post by:
On my form I have combo boxes. These combo boxes, after updating them, populate respective listboxes that are located below the combo boxes on the same form. I am trying to use a "generate...
3
by: creative1 | last post by:
Here is how you create a complex data report that involves parent and child commands and you can update information at runtime. Its pretty straight forward to work with simple queries; however,...
12
by: Studiotyphoon | last post by:
Hi, I have report which I need to print 3 times, but would like to have the following headings Customer Copy - Print 1 Accounts Copy - Print 2 File Copy -Print 3 I created a macro to...
11
by: Gord | last post by:
When I open a certain report, it runs some code that generates the records that will be displayed in that report. This works fine. When I go to print preview the report it appears that the code...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.