Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Crystal Reports and VFP
Message
From
31/12/1998 09:15:01
 
 
To
30/12/1998 16:30:18
General information
Forum:
Visual FoxPro
Category:
Third party products
Miscellaneous
Thread ID:
00171679
Message ID:
00171858
Views:
28
I have been using Crystal for about 5 months now. And have had much success using fox2x tables. I felt that the ODBC stuff simply added a level of complexity that I did not need. Remember, you have to install the ODBC stuff on all the endusers systems in order for it to work, and any chance to avoid making my job difficult is something I run for.

I don't use the Active X control. I use the CRPE. The Crystal explorer document "Seagate Crystal Reports\sample\Xtreme\browser\CrystalExplorer.exe"
has been a great help for working with this object. Here is how I print a Crystal Report from foxpro.

I copy the tables to c:\temp just like you do as fox2x and then issue these commands to get things rolling.

local WS_MAXIMIZE
WS_MAXIMIZE = 29949952

loApp = CreateObject("Crystal.CRPE.Application")
loReport = loApp.openreport('The name of your report.rpt')

* You need to let the Report know that the Database has changed
loReport.Database.Verify

* Start the Crystal Preview Method
loReport.preview("The caption for the preview window",,,,,WS_MAXIMIZE)


Now keep in mind that when you design your report, you will have to design it from a fox2x table.

Also bear in mind that the preview method is not modal. Foxpro will move on after the preview method is called. This causes a problem that you can resolve by creating a modal form that calls the preview method. And set this form such that it stays open as long as the preview window is visible. This is all done with a little timer magic and API magic.

And here is the Timer/API magic

* BEGIN ModalTimer.TimerHook()
* Description: Look through all Windows to see if our preview is still active. If not,
* delete the database files, release the crystal app, and release this form.
* Revisions: 10/09/1998 - JLW
* - Created
DECLARE INTEGER FindWindow IN Win32API;
STRING @lpClassName, STRING @lpWindowName

if FindWindow(.NULL., "The caption for the preview window") = 0

&& Release loApp
thisform.loApp = .F.

* Remove the temporary files
_screen.mvApplication.ReportManager.DeleteTableNames()

thisform.release()
endif

return
* END ModalTimer.TimerHook()


Set this timer to fire every 5 seconds or so and when the user closes the Preview window, this timer event will catch on and then end the whole show.

I hope this is helpful. The guys at Crystal didn't even know about this one. Of course, I don't think they know Foxpro Exists.

Jeremy Weidig
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform