Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating New Crystal Report File

Status
Not open for further replies.

lucyv

Programmer
Mar 11, 2002
152
US
Okay, here's my situation: at work my boss has asked me to write a program that allows for our users to pull certain data from our database. Once they have this information displayed on their screen he wants a way for the users to export that data to certain formats (i.e. Excel, Text, etc).

My question to you is this: is there a way where I can build a new Crystal Reports file (.rpt) on the user's workstation and then pass all the data to the new report?

Unfortunately, because I do not know the exact format of the data they are pulling, I can not create a pre-defined report for them. It would be really nice if the system could pass the data to the report and have it do it for me.

Any thoughts and/or suggestions would be greatly appreciated.

(BTW, we're currently using VB.NET and CR10.)

-lucyv
 
Lucy

It would appear from what you describe that the data you pull will be of a flat file format...one table, simple order by clause and maybe a simple group by clause.

Perfect for a datatable, which in turn lends itself quite nicely to generating your own printdocument class to display it, and also lends itself very nicely to Excel export.

Another way would be to create a standard CR with say up to 20 columns, and pass all the column headings in as parameters, and have a fixed table format which you populate eg field1,field2,field3, as your CR dataset.
The only thing Im not sure of this way is if you can adjust the column start positions and widths?




Sweep
...if it works dont f*** with it
...if its f****ed blame someone else
...if its your fault that its f***ed, say and admit nothing.
 
Sweep,

Using the PrintDocument class is definately one of my options, but I'm looking for other alternatives as well (just in case).

Unfortunately I don't think 20 columns would be adequate enough for my situation. Our users could be pulling any number of fields from multiple tables.

Here's another question: if I was to use the PrintDocument class to display and print my report, is there a way I could save this report to their computer? This way, instead of having to re-run the query every time, or having to export the info to Excel, they could just open this file to view their data.

-lucyv
 
Well, its certainly possible. You could generate your SQL command dynamically and then save the Select statement in little more than a text file. How will your users generate the SQL required. Are you going to provide a GUI to do this?. If you're talking about saving a copy of the report at its "moment in time", then you would be best advised to either output the printdocument as a pdf (3rd party controls needed), or simply to save the underlying dataset as an XML file (dataset has writexml and readxml, which is perfect for this)

What you're in effect trying to do is develop your own report generator, which will involve a lot of time and effort.



Sweep
...if it works dont f*** with it
...if its f****ed blame someone else
...if its your fault that its f***ed, say and admit nothing.
 
Sweep,

I understand saving the dataset to an XML file, but how would I go about displaying it to the user?

My first thought would be to develop another program that would read the XML file and in turn would "spit out" the data onto the report.

Is this what you're talking about?

-lucyv
 
That was my initial thought too...

Sweep
...if it works dont f*** with it
...if its f****ed blame someone else
...if its your fault that its f***ed, say and admit nothing.
 
Thanks Sweep, at least I'm not alone with this idea. I gonna try writing a simple prototype that will do this so that I can show my boss.

I'm not sure how involved this project will be, but I'll keep you posted as things progress.

Thanks again!

-lucyv
 
yw lucy

I hope your boss appreciates the enormity of the project. Ideas like these are great in theory, and yet when it comes down to it, the users will just run basically the same reports time after time.

Are your users up to knowing how the tables relate, or is that something else that you will have to self build in?

Good luck





Sweep
...if it works dont f*** with it
...if its f****ed blame someone else
...if its your fault that its f***ed, say and admit nothing.
 
I understand what you mean about running the same reports time after time. I'm just worried about that one person who will not want to log into the system and re-pull the data. He or she will probably want a snapshot of the data was it was when they pulled it.

To answer your second questions, I've written this system so that it automatically knows how the tables are related together. During the analysis phase of the project this was a major concern, since almost all of my users will not know how the tables are related.

-lucyv
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top