Getting started with Crystal Reports...little help in the far court.

M

Mudcat

I am not that familiar with Crystal Reports, but having read some other
posts I know that the way to integrate the API with Python is through
the COM interface provide by win32all.

However, I have been unable to find any other information on how to get
started. I've used the COM interface before in integrating Excel and a
couple of other things. So I am familiar with how that works. But there
are at least 40 options dealing with Crystal and Business Objects. I
have no idea which makepy file to create or which one provides the
functionality I need.

I'm not looking to do much. All I'm really trying to do is provide one
application where a list of crystal reports can be selected and ran in
series. Right now we have a lot of reports that all have to be run
manually (takes a while). So I think all I need api access to is server
selection, parameter selection, and output formats.

Any pointers in the right direction would be helpful.

Thanks,
Marc
 
A

Amaury Forgeot d'Arc

Good evening,

Mudcat a écrit :
I am not that familiar with Crystal Reports, but having read some other
posts I know that the way to integrate the API with Python is through
the COM interface provide by win32all.

However, I have been unable to find any other information on how to get
started. I've used the COM interface before in integrating Excel and a
couple of other things. So I am familiar with how that works. But there
are at least 40 options dealing with Crystal and Business Objects. I
have no idea which makepy file to create or which one provides the
functionality I need.

I'm not looking to do much. All I'm really trying to do is provide one
application where a list of crystal reports can be selected and ran in
series. Right now we have a lot of reports that all have to be run
manually (takes a while). So I think all I need api access to is server
selection, parameter selection, and output formats.

Any pointers in the right direction would be helpful.


In my previous job we had to to almost the same thing.
If I remember correctly, for batch printing or file export it was enough
to start with the "CrystalRuntime.Application" class.

It was something along these lines (sorry I don't have any way to test
it now.):
app = win32com.client.dynamic.Dispatch("CrystalRuntime.Application")
report = app.OpenReport("c:/path/to/file.rpt")
for table in report.Database.Tables:
table.ConnectionInfo.Password = "passwd"
...
The rest is modeled after Visual Basic. There are tons of examples on
the net.

If you want to show the report on the screen then it is another story.
I only remember the following:
- the application must be a mfc application
- I had to "makepy" a class. I think it was "CrystalReportsViewer".
- create a class derived from both pywin.mfc.activex.Control and
CrViewer (look at the script generated by makepy).
- create a pywin.mfc.Frame, and put there an instance of the previous class.

Voilà, it's not much.
In the hope that you can do something with it.
But don't give up. At the end, it works...
 
B

Brian

Mudcat said:
I am not that familiar with Crystal Reports, but having read some other
posts I know that the way to integrate the API with Python is through
the COM interface provide by win32all. .....
Any pointers in the right direction would be helpful.

Like Armury, I worked on Crystal stuff quite a long time ago. Here's a
script I was able to dig up. Edited to protect the innocent. ;-)

import sys
from win32com.client import Dispatch

app = Dispatch('CrystalRunTime.Application')
rep = app.OpenReport('foo.rpt')
tbl = rep.Database.Tables.Item(1)

prop = tbl.ConnectionProperties('Password')
prop.Value = sys.argv[1]

prop = tbl.ConnectionProperties('Data Source')
prop.Value = 'server'

# tbl.TestConnectivity() should return 1

# clear and set 3 parameters
params = rep.ParameterFields
p1 = params(1)
p2 = params(2)
p3 = params(3)

for param in (p1,p2,p3): param.ClearCurrentValueAndRange()

p1.AddCurrentValue(123)
p2.AddCurrentValue(456)
p3.AddCurrentValue('12/31/99')

rep.PrintOut(promptUser=False)
 
C

Carl Trachte

Marc,

I've been able to get some Business Objects COM functionality in
Business Objects 6.5 (the logging in functionality I have to do through a
call to an Excel VBA macro; otherwise things appear to work for what I'm
doing).

Unfortunately, I don't have experience with Python in Business Objects
XI or Crystal Reports. I did have to play with makepy on a couple Business
Objects files to get something useful. I believe I eventually struck
paydirt with busobj.exe (but don't quote me on it - it's been a while).

This information probably isn't terribly useful. The best advice I can
give is to try the respective Crystal Reports and Business Objects XI
executable files with makepy. If there's no joy there, start working with
the dll's and see if they yield something that works.

Hopefully someone with a bit more win32 or BO XI experience will chime
in. In the meantime, good luck.

Carl T.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top