on 09-15-2008 10:33 AM
I have previously used vbscript to run a crystal 9 report and output as a pdf. The vbscript used the contents of an excel spreadsheet as parameters. the following code was used to load the crystal report
Dim crApp
Dim crReport
Set crApp = CreateObject("CrystalRuntime.Application.9")
Set crReport = CreateObject("CrystalRuntime.Report.9")
Set crReport = crApp.OpenReport(sReportFile)
crReport.Database.Tables(1).SetLogOnInfo "", "", "USER", "PASSWORD"
'-- clear the last used parameters
crReport.ParameterFields.GetItemByName("P1").ClearCurrentValueAndRange
following this there is a section that loops through the spreadsheet and adds each value into the parameter field P1. It then runs the report for the parameters and exports it to a pdf.
I have been trying to reproduce this function using a newly purchased copy of Crystal 2008 and Microsoft Visual Basic 2008 Express Edition however cannot even figure out how to initiate the crystal 2008 runtime.
I have read multiple pages suggesting that this needs to be done differently due to changes in the way cr2008 works but cannot find a solution.
can someone please help point me in the right direction....
Cheers
Hi Troy,
The usage and functionality of Crystal can be understood by going through [this|https://boc.sdn.sap.com/node/7770]. Some samples available in the same location will also help you to proceed ahead.
However make sure that CR2008 got integrated with VS as our product is not tested with Express edition, however we need SP0 of CR2008 to get integrated with VS2008.
It seems that you wan to pass parameter to the report so you can use
ReportDocumentObject.SetParameterValue("parameter name",value);
to do so.
Hope that helps!
Regards,
AG.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am trying something similary, but what I need to know, is that after the report is exported, is there a way to find out how many rows were exported?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Doug:
You should be able to find out the number of records in a report by using this line of code:
reportDocument.database.rows.count.toString()
E.g.; as a quick test I added a line of code just after setting a datasource and after the report shows up in the viewer:
messageBox.show (reportDocument.database.rows.count.toString() )
and I got the number of records in the report.
This will work on a "saved data" report as well as a "live" reportDocument (e.g.; in your project before you terminate the report object).
Ludek
Thanks to everyone for their assistance. I should have enough information now to figure it out.
Cheers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Do I need to use the CrystalReportViewer to run the report programattically. I dont want the user to see the report as the old statement used to loop through and run the report multiple times for different parameters.
Sorry, i have tried to go through the documetation suggested but cannot find an answer and the samples will not download for me.
If possible i want to do this through a windows app not web
Edited by: Troy Eversen on Sep 16, 2008 2:34 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You do not need to use the viewer. You can export or print directly. See if you can download the following file:
https://smpdl.sap-ag.de/~sapidp/012002523100006252822008E/net_win_smpl.exe
it contains a number of VB .NET samples that demo exports as well as direct print. Not knowing which version of .NET you are using, you may have to let .NET upgrade the sample apps. This should be done by .NET automatically.
Ludek
Hello Troy,
The CrystalRuntime.Application is a Report Designer Component (RDC) SDK object - it's referencing the craxdrt.dll.
The RDC was deprecated with Crystal Reports XI Release 2, and the craxdrt.dll is not included with Crystal Reports 2008.
The RDC remains fully supported with the previous version - Crystal Reports XI Release 2.
So the option you have is:
Migrate to Crystal Reports .NET SDK, a .NET-based SDK - however, you won't be able to VBScript it (you can create a .NET app, however).
Use Crystal Reports XI Release 2 - in that case, I'd alter the "9" in the CreateObject argument - it's explicitly referencing version 9.
Sincerely,
Ted Ueda
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.