Crystal Reports & VBScript - Could Not Locate Automation Class - scripting

First off, I have very little Crystal Reports experience, so apologies in advance if this is a stupid question. I had this "fantastic" work project dumped on me when a co-worker left, so I'm hoping someone can help as most of the Business Objects links I find that might have solutions just redirect to a generic SAP splash page.
So I have a few hundred Crystal Reports (mostly File Schema 10.2, although some are 8.5 or 12.0) that are stored on a server. All of them have an associated VBScript file that calls them in the following way:
Set AppCrystal = WScript.CreateObject("CrystalRuntime.Application.10")
Set CrystalReport = AppCrystal.OpenReport("<file path to report>")
Set CrystalOptions = CrystalReport.exportOptions
CrystalOptions.DestinationType = 1
CrystalOptions.FormatType = 36
CrystalOptions.DiskFileName = "<file path to output excel file>"
CrystalReport.Export False
According to BO, this should be correct. See the following links about the CR API:
http://devlibrary.businessobjects.com/businessobjectsxi/en/en/RDC_SDK/rdc_com_dg_doc/doc/rdcsdk_com_doc/RDC_ObjectModel62.html
http://devlibrary.businessobjects.com/businessobjectsxi/en/en/RDC_SDK/rdc_com_dg_doc/doc/rdcsdk_com_doc/RDC_ObjectModel151.html#1387900
http://devlibrary.businessobjects.com/businessobjectsxi/en/en/RDC_SDK/rdc_com_dg_doc/doc/rdcsdk_com_doc/RDC_ObjectModel8.html#1646326
So basically the script just executes the report and outputs it to an Excel file. This works great on the old server, but when I try to execute this script on the new server I get the following error:
I assume this is because there's some kind of runtime components I need to install, but I can't for the life of me figure out what. I found this page: https://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=56787567
But none of the files I've tried to download have worked, and, frankly, I've found SAPs documentation to be sub-par in this area. I do have Crystal Reports 2008 available, so if I need to update the vbscript to use CrystalRuntime.Application.12 or something and then install the newest runtime files for Crystal Reports 2008 on the server, that'd be fine. But I still need to know what runtime files to use? Nothing I can find has worked. Help?

Apparently this type of call to a Crystal report uses the RDC Report Engine, unfortunately CR 10 is no longer available. You can still get CR XI R2 which still deployed the RDC and it's version 11.5.
There is no RDC in CR 2008, it was actually deprecated in CR 9 and now no longer shipped.
Only other option you have is to convert your app to use Visual Studio .NET and use one of the current CR 2008 or CR for VS 2010 components and rewrite your app to .NET Framework.
No more VB Scripting supported, but that was just the Dev Language...
I ended up just upgrading to CR 2008, and using .NET console projects to replace the VB scripts.

Related

SSRS Deployed Report Not Executing WHERE clause

I have an SSRS report that works perfectly in Visual Studio 2017.
But when I deploy it, the deployed report comes back with all the data, ignoring the filters in the WHERE clause. I know it's this because when I remove the WHERE clause from my Visual Studio report, the data matches the deployed report.
This report pings off a shared data source; the dataset is not a shared.
Even a simple WHERE tbl.flag = 'Y' does not seem to do anything to the deployed report.
Why is SSRS not recognizing the entire SQL?
Not really an expert in SSRS, I just make them based off some YT tutorials and deploy them to the link that was given to me, so any advice or links for research are appreciated.
Check the server setting in the report project properties in Visual Studio.
If they look OK then delete the server copy of the report and redeploy.
If the report does not reappear then that proves that the report is either
a. not being deployed (you should see an error in the visual studio output window), or
b. it's being deployed to where you think it should be.
From the web portal you can search for a report by name and it will search all folders on the server so if it did deploy OK, you could find it that way.
I have discovered the issues was some inline comments I had in the SQL. I had some comments above the WHERE clause using dashes, --, explaining the filter. Once I removed it, the report executed correctly.
I was also able to change the comment style to the /* <my comment> */ and it executed correctly. It seems that other style of comments with dashes made the server think everything afterwards was a comment, and therefore not executed.

Error opening an .RPT Crystal Report file

I have a crystal report .RPT file which was created in 2004. I am having trouble opening it using software like VB or Crystal Report. It shows "Failed to open Document", follow by "Invalid Report Schema". Seems like the file itself it corrupted, but there is an application generating reports using this file that is still running fine, and it is able to read the file without any problem.
Is there any other software I can use to possibly open this file up? I need to edit the formula expression in a couple fields. When I tried NotePad++, it shows a bunch of unreadable characters which don't help at all. By the way, this file seems to be consisted with a bunch of reports. (There are about 10 reports within this .RPT file.)
I am not sure what the problem is here, could anyone please help me? Any help/suggestion is greatly appreciated!
Thanks,
In that era of Crystal Reports, version 10 would have been the current release. Through version 10, .rpt files could not be successfully opened by any version earlier than the version which last saved the file. Ergo, to open and edit the file, you need the designer/editor for the version which produced that file, or else a newer designer/editor.
If your current Crystal Developer tool wont open it, then it is from a newer one than you are using, or it is truly corrupted ( but since you say it is running well within an application then it's almost certainly not corrupted ).
You need to determine specifically what version of Designer DLL is being invoked by the application that is running the report. Open the source code project and look at the REFERENCES, get the name and GUID of the CRAXDRT.DLL ( or CRAXDDRT.DLL ) and then find exactly that entry in the registry. There you will see which version of Crystal Designer deployed that CRAXDRT.DLL. THAT is the edition you should be able to open the file with.
If you dont have that edition in house, you will have to go to SAP ( or eBay , etc ) and buy one. The oldest SAP sells now is version 11, which should be able to open 8.5 rpts and above. version 11 no longer has support from SAP ( yes, they sell it but no longer sell support, I know, it was only a week ago I talked to them about upgrading my v10 to something newer ). And v12 support is soon to be dropped.
It looks like you are at the crossroads of a Crystal upgrade. If you are still working with VB6 as your application language, then V11 R2 is probably your best bet. g'luck.. I feel your pain. I been there.

Editing an .rpt file

A company developed a small web interface written in VB.net to query a database and produce reports. The interface uses CrystalDecisions.Shared library. In the code, it references this:
If rbExportType.SelectedValue = "PDF" Then
Dim sda As New DB2DataAdapter(cmd)
ReportName = "Reports/R002.rpt"
rpt.Load(Server.MapPath(ReportName), CrystalDecisions.[Shared].OpenReportMethod.OpenReportByTempCopy)
sda.Fill(ds.tbl_R002)
rpt.SetDataSource(ds)
rpt.SetParameterValue(0, ddDatabase.SelectedItem.Text)
ExporttoPDF()
Else
Now, the users have asked me to add a simple field to the report, Date. I've edited the query to pull this data, but when I run the report the Date field is not shown on the report. I'm assuming that the actual .rpt file has to be edited to include this field on the report.
When trying to edit Reports/R002.rpt in a text editor, there are just numbers/symbols.
How can I edit this .rpt file? The version of Visual Studio 2010 has past it's trial.
Visual Studio has (or had) a Crystal Reports editor built in. I couldn't find it just now in my Visual Studio 2012 install, so it's possible they dropped it in favor of their own Reporting Services platform, but I might just have missed it. If you can't find the editor in your Visual Studio 2010 copy, try downloading an older version of Visual Studio.
Update:
A quick Google search indicates that it's simply distributed separately now.
Here's the VS2012 version: http://scn.sap.com/docs/DOC-35074
Here's the VS2010 version: http://scn.sap.com/docs/DOC-7824
CrystalReports is a proprietary software and wouldn't be part of the default VS package.
And yes, in order to add a field to the report, you would have to edit the report itself. Its not that big of a deal, if you have a copy of the CrystalReport software.

reading excel server-side

I need to develop a service and install it into a w2003 box to read excel files a then process its info. The process is as follows, users will upload excel files using FTP and then my service must take those files, validate and then update a SQL Server DB.
The application runs fine on my computer but on the server it asks for the libraries but when I try to install the MS office 2003 Primary Interop Assemblies, system displays "Please install Microsoft Office 2003 before installing the product".
I'd prefer to stay away of any server upgrade as we should require OKs, etc.. so, is there a simple way to just read excel files without having to install any update in the server.
any comments are welcome.
Thanks,
m0dest0.
ps. using vb.net and vs 2008.
Using Interop on the server is NOT supported by MS - see http://support.microsoft.com/default.aspx?scid=kb;EN-US;q257757#kb2
Since Windows Vista MS introduced several security-related measures which prevent a Windows Service from doing "desktop-like" things... which means you would have to circumvent several security measures to get it to work (NOT recommended!).
To deal with Excel in a server-scenario there are several options (free and commercial) out there:
I can recommend Aspose.Cells and Flexcel... didn't try SpreadsheetGear but hear+read lots of good things about it...
Free options (though for the newer xlsx format only!) are for example OpenXML 2 from MS and EPPlus.
For a solution with nothing to install on any recent versions of Windows Server..... I'm not sure the exact VB.NET code, but you should easily be able to do this on any machine using the Microsoft OLEDB drivers that should be available on any recent version of windows server or can be installed from a free download off of the Microsoft website for very old versions of windows server. I'll try to pseudo code this, so you will have to adapt it for VB.NET. Note that in order to reference your fields by name, the first row of the selected area in the worksheet must contain the fieldnames in the column values. Otherwise you will simply have to use numeric values to index each returned field by column position.
Set objExcelConnection = CreateObject("ADODB.Connection")
objExcelConnection.Provider = "Microsoft.Jet.OLEDB.4.0"
objExcelConnection.ConnectionString = "Data Source=d:\path\to\excel\file\on\your\server.xls;Extended Properties=""Excel 8.0;IMEX=1;"";"
objExcelConnection.CursorLocation = 3
objExcelConnection.Open
sSQL = "select * from [worksheetname$]"
set rsWorksheet = objExcelConnection.Execute(sSQL)
do while not rsWorksheet.Eof
sValue = rsWorksheet("FieldName")
rsWorksheet.MoveNext
loop
rsWorksheet.Close
set objExcelConnection = nothing
I use the Excel Data Reader (http://exceldatareader.codeplex.com/) when I need to process Excel files. It handles xls and xlsx files without a hitch, and I've got it running in a few applications on a server OS. It saves each sheet as a DataTable object, and each "cell" in the DataTable corresponds to the Excel cell with the same address. Depending on how you set up your SQL server link, there might not be too much conversion required to dump the contents into the DB.

convert rdl to rdlc?

I am using visual studio 2008 and reporting service 2008.
I created a .rdl reports. Now I want to convert .rdl to .rdlc. How can I do it?
Good question. According to spec whey should be more or less the same, but in reality they differ wildly depending on version. For instance if I open an RDLC file I created in Visual Studio 2010 in Report Builder 3.0 it works. But if I make a change in my RDL(C) file and try to open it in VS2010 I first get asked if I want to convert it to RDLC 2008 format (yes) and then I get the error message "The report definition has an invalid target namespace 'http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition' which cannot be upgraded."
There is nothing to convert. All you have to do is to rename the file to .rdlc. This converts it from a server report to a client report. The underlying schema is the same, whether it's an .rdl or .rdlc file.
Take a look at FAQ #8 here: http://www.gotreportviewer.com/
I found working with MS support that converting an RDL to RDLC merely by changing the extensions results in a ReportViewer Control HTTPHandler error which is shown with a style of "dsiplay:none". It accuses the developer of not including the HTTPHandler in the web.config, when it is actually in the web.config. Using an rdlc created by VS in that project, then the reportviewer opens just fine and properly displays. MS support and I are still researching what other changes need to be made, but as of now, I can let people know not to drink the MSDN Kool-Aid.
I also tried changing the schemas namespace in the XML file and I got the same report definition cited above.