• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1360
  • Last Modified:

Executing a Crystal Report (on Windows) using Perl (on Linux)

Has anyone tried running a Perl script on Linux/Unix to execute a Crystal Report 9 (.rpt) on another Windows server?

If so, could you please specify what Perl modules are needed and provide sample code.

Thanks in advance,
COS_IT_AU
 
0
COS_IT_AU
Asked:
COS_IT_AU
  • 2
1 Solution
 
tomaugerdotcomCommented:
Can you go into a bit more detail about the relationship / connection between the two servers? Are you going to execute the report via HTTP? Or are you looking for a more direct socket connection? Has the report already been generated and then needs to just be triggered? Or do you need to actually create the report on the Perl box and transmit it to the Windows machine?

Would it not be just simpler to install ActivePerl on the Windows Box and port your Perl script to Windows, cutting out the Linux server altogether?

Tom
0
 
COS_IT_AUAuthor Commented:
Hi Tom,

Currently I have a Crystal report template (samplereport.rpt) created in Crystal Report 9 and use a win 32 Delphi program to connect to a database, grab some parameters and using a Delphi Crystal package to pass it to the Crystal Report template (samplereport.rpt) to generate a nicely formatted PDF.

I would like to transfer this process to Linux using Perl as all our nights jobs are done in Perl on a Linux box and to reduce administration of multiple OS boxes. Basically I want to replicate what Delphi does with Perl, where it will grab some parameters from a database, then use some Perl package to pass the paramters to the Crystal report template  (samplereport.rpt) and execute it to create a PDF.

My question is:
1) Is there a Perl package available to interact with Crystal Reports .rpt files under Linux?
2) If not, what other methods are available using Perl on a Linux server to execute .rpt located on a Windows server? You mentioned HTTP (would this mean the Crystal Report Server version is required?) and direct socket connection.

Cheers
0
 
estrelowCommented:
Hi Tom,

I've got Crystal Reports 9 myself and an Unix box, but I haven't done this. It would be possible following these steps:

1) Set up the CR engine under IIS on the Windows machine. I'm currently doing this to expose the reports over out intranet. The reports are generated on-the run. Query parameters can be provided either by POST or GET. The IIS machine appears as the database client.
2) There's probably license limitations to this. I have the Enterprise CR. I'm not sure if other flavors allow the IIS setup. Anyway, you will always need a host for the CR engine.
3) On the http client-side (Unix in this case), CR can act either as an ActiveX component, a Java applet or plain HTML. You should use plain HTML, setup a LWP request and then use htmldoc to get the desired pdf. Using plain HTML under CR9 loses a great deal of formatting, though.

In that scenario, the perl script should be like:

use LWP::SImple;

my $querystring=GrabSomeParametersFromDatabase();
getstore("http://mywindowsbox/showreport.asp?$querystring","report_for_today.html");
system("htmldoc -f report_for_today.pdf -t pdf report_for_today.html");

You should have guessed that the showreport.asp is the tricky part. CR9 provides a no-brainer sample for this.

0
 
COS_IT_AUAuthor Commented:
Hi Estrelow,

looks like there is no avoiding for Perl to use a secondary script either ASP or VBSCRIPT on the Windows machine to interact with Crystal instead of Perl directly interacting with Crystal.

I found this Perl snippet through Google which is very similar to your example:
system("WSCRIPT","crystal.vbs","$crystal_rpt_name","$username","$ibookref","$out putfile");

Thanks,
COS_IT_AU
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now