Link to home
Start Free TrialLog in
Avatar of khadija_saeed
khadija_saeed

asked on

Problems faced in calling crystal reports from power builder

hi,

I need help on how to call crystal reports 9.2 from Power builder 7.0. Is there any other method other than OLE ? If not then which type of OLE control should i use for the purpose?

Khadija
Avatar of sandeep_patel
sandeep_patel
Flag of United States of America image

hi,

i don't know other methods, but i worked with crystal32.ocx in PB. Using this ocx u can use crystal reports with pb. Perhaps this ocx comes with setup of crystal report.

$regards.
Avatar of khadija_saeed
khadija_saeed

ASKER


For Sandeep Patel,

The crystal32.ocx ....what is this ...an OLE control or what?  and what is the complete method of using it?  i have searched for this ocx in the setup of crystal reports 9.2 that i'm using but cant find.

Can u give me some explaination?

i'd be grateful!
Thanks

Khadija
sorry its crystl32.ocx,

u can use it like any ole control. I have crystal report pro and this ocx is along with it. Just put it on your window and use it's properties and functions like any other object. If you don't have any idea about using ole in pb then tell me again i will explain in detail.

-sandeep.


Avatar of namasi_navaretnam
1) Select "OLE" control from control list
2) Select "Crystal Report Viewer Control" from "Insert Object/Create New" tab. (This control will show only if Crstral Reports installed on your PC or the ocx control installed and registeredd in your PC.
3) Drop this control on your window
4) Add a command button and add the code below (ole_1 is the name of the control)

ole_1.object.ReportName = 'Report'
ole_1.object.ViewReport()

5) You can view all available functions and properties by selecting object browser from PB toolbar and the selecting "OLE" tab.
6) Once selecting OLE tab, look for your control and you can see all available functions and properties for this control.

HTH

Namasi Navaretnam
Hi

Y u need cystal report in powerbuilder !!. u can very well use datawindow for any sort of reporting very effectively...what i recomend u is use datawindow instead of crystal report. if u hav any pblm on datawindow let me know i can help u.

 
but if u need crystal report itself then connect with database b4 calling the report

ole_rep.object.Connect = "ODBC;DSN=hamish;UID=sa;PWD=put_ur_pwd_here"

then call

ole_rep.object.ReportName = ls_rep_path + as_report_name
ole_rep.object.ViewReport() // or ole_rep.object.action = 1

rgrds
gafoor
When we went to crystal 8.5, my understanding was that crystal was going to be providing limited support and updates for the ocx so we choose to use their RDC (report designer component) feature.  We were using ocx and converted to RDC. I would assume this would be available in 9.2 but we are not on that version.  It's something you may want to check out.  We wrote a user object to handle generation of reports as they were passed to it that uses RDC programming and it works quite well.  We use crviewer to view the reports and their export feature to generate them to print or files as requested.

We do have some issues with the viewer if the your desktop settings are less then 1024x768 so that is now our standard for running this app.
When we went to crystal 8.5, my understanding was that crystal was going to be providing limited support and updates for the ocx so we choose to use their RDC (report designer component) feature.  We were using ocx and converted to RDC. I would assume this would be available in 9.2 but we are not on that version.  It's something you may want to check out.  We wrote a user object to handle generation of reports as they were passed to it that uses RDC programming and it works quite well.  We use crviewer to view the reports and their export feature to generate them to print or files as requested.

We do have some issues with the viewer if the your desktop settings are less then 1024x768 so that is now our standard for running this app.
hi Gafoor,

Thanks for the help but actually it is our client's requirement to develop the reports in Crystal Report writer.

Now i have used the connect property of the crystal report viewer control to connect to the database, but it gives error as there is no such property or function. There is another function called 'ReportSource()' but it is used as such:

ole_rep.object.ReportSource(lunknown dsip member)

now there is no help in PB about this function, neither about the datatype lunknown. How can i use it?

Hi kadeeja

i didn't noticed that u r using crystal report viewer...instead i will tell u the approch

1. delete that crystal report viewer from ur window
2. click the ole control
3. then click the tab ' insert control '  from the opened window
4. from the control list select ' crystal report control '. ( if u cudn't see, then u hav to register its ocx crystal32.ocx with regsvr32 or from that window itself by clicking register new ). this will be automatically registered if u installed crystal report in ur system

5. put the control in ur window
6. then code this to view the report

   //connect report with dsn
   ole_1.object.Connect = "ODBC;DSN=hamish;UID=sa;PWD=put_ur_pwd_here"

   ole_1.object.ReportFileName = ls_rep_path + as_report_name // report file

   // view report
   ole_1.object.action = 1

7. run ur application, then u can see the report .


rgrds
gafoor
hi khadija

ur problem solved ?..... any more doubts, let me know then

rgrds
gafoor
Hello Gafoor,

Thanks for the help. my problem was solved.

Regrds
Khadija
Saeed, Why not award the points  and close the issue.
ASKER CERTIFIED SOLUTION
Avatar of gafoor78
gafoor78
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I want to call Crystal RPT(Crystal 8.5) files from Power builder 11.2. I tried above steps but not able to call. I have Crystal Viewer.
Please let me know what needs to be done for the same