Crystal Reports in Cimplicity HMI

E

Thread Starter

Eric J. Feight

I’m stuck. I finally gave in and decided to learn Crystal Reports for use with various HMI applications. Ultimately I would like to develop a standard set of reports that we can use for all of our HMI applications. With the push to connect SCADA networks to the enterprise, Crystal seems to be the report package of choice. I have started out with 8.5. I have spent several hours on the phone with Seagate Software and have learned that they want you to use their new ActiveX object “Crystal Report Viewer Control”. I cannot get it to work. The .ReportSource method fails. I can get the older OCX object “Crystal Report Control” to work, but this opens the report in a separate window not imbedded in the screen. I can also get compiled reports to work, but you cannot automatically pass parameters to them at runtime. I have also been told by Seagate that these two methods will not be supported in the future. I have been working with Cimplicity HMI because that’s the HMI package I have the most experience with. If I can get it to work with Cimplicity, I don’t think I’ll have to much trouble porting it over to RSView, etc. (always the optimist!)

The following is a the script that should run to select and view the report C:\Report\HMIReport.rpt. In an effort to debug I have used break points and dialog boxes. I have determined that everything works fine except for: “cimOleObj.ReportSource = Report”. I am not the greatest VB programmer, but this doesn’t seem like rocket science. There has to be some little thing I’m doing wrong. Any suggestions?



Private cimOleObj As CRVIEWERLib.ICrystalReportViewer4

Sub Preview()

Dim Report As Object
Dim CSApplication As Object
Set Report = CreateObject("CrystalRuntime.Report")
Set CSApplication = CreateObject("CrystalRuntime.Application")
Set Report = CRApplication.OpenReport("C:\Report\HMIReport.rpt")
cimOleObj.ReportSource = Report
cimOleObj.ViewReport

End Sub
 
What sort of error do you get when you hit the line?

To catch the error add something like

Sub ....

on error goto trapper

....


trapper:
MsgBox err$ & " Line: " & erl
 
I tried to get crystal report in cimplicity through ole activeX crystal report viewer control, but don't get any view. Also tried to add control which requires ".ocx or .dll" file. I also tried by writing script provided here. I didn’t get any error but it also not worked.

Can you help me how did you opens the report in a separate cimview screen?

<b>Moderator's note: for people who read the forum via email. Script from original message below</b>

Private cimOleObj As CRVIEWERLib.ICrystalReportViewer4

Sub Preview()

Dim Report As Object
Dim CSApplication As Object
Set Report = CreateObject("CrystalRuntime.Report")
Set CSApplication = CreateObject("CrystalRuntime.Application")
Set Report = CRApplication.OpenReport("C:\Report\HMIReport.rpt")
cimOleObj.ReportSource = Report
cimOleObj.ViewReport

End Sub
 
I have done quite a bit of reporting using Crystal V8.5 in a VB6 Application - so it probably is not quite the same but I may be able to give you some hints.

From what I see is that the reportsource doesn't accept an object it must be a report object .

Using the ActiveX viewer on your page, (your project must have a reference to the viewer.) this is the code that I would use in VB6.<pre>
Public Rep_App As CRAXDRT.Application
Public Rep_Main As CRAXDRT.Report

Public Sub LoadReport()
'
Set Rep_App = New CRAXDRT.Application
Set Rep_Main = Rep_App.OpenReport("C:\ my report .rpt file path ")


With CRViewer
.ReportSource = Rep_Main
.ViewReport
End With

End Sub</pre>
The CRViewer is just the reference to the viewer on the page.

I hope this helps you.
 
Top