Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Crystal Reports integration
Message
From
18/04/2000 02:44:32
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Third party products
Miscellaneous
Thread ID:
00360732
Message ID:
00360742
Views:
17
>What is the best approach to calling Crystal Reports within VFP application? automation server, ActiveX ...
>
>I'm using activeX now, but heard that may not be the best approach.
>
>Thanks.
>
>John.


John,
Before I started to use Crystal I read messages especially from Craig regarding ODBC way would be slow. When I started to use it directly hooked with nonODBC approach and liked it. This is basic skeleton I use :
select * from myTable where SomeField = "SomeValue" into cursor myCursor
=CrystalRep("myCursor","c:\myCrstalReports\myReport.RPT","myTable")

*!*	function CrystalRep
*!*	lparameters tcCursorName, tcRPTName, tcTableName
*!*	lcAlias = alias()
*!*	select (tcCursorName)
*!*	lcTemp = sys(2015)
*!*	Copy to (sys(5)+curdir()+lcTemp) type fox2x
*!*	oCrystal=CreateObject("Crystal.CRPE.Application")
*!*	#Define WS_MAXIMIZE  29949952
*!*	DECLARE integer GetForegroundWindow in WIN32API
*!*	DECLARE short IsWindow in WIN32API integer
*!*	oRpt = oCrystal.OpenReport(tcRPTName)
*!*	With oRpt
*!*	  With .Database.Tables(tcTableName)
*!*	    .Location = sys(5)+curdir()+lcTemp+".dbf"
*!*	  Endwith
*!*	  .preview ("Report Preview ",,,,,WS_MAXIMIZE,0)
*!*	Endwith
*!*	lnHwndActiveX = GetForegroundWindow()	&& Save word window handle
*!*	DO while IsWindow(lnHwndActiveX) # 0  && Wait while Activex Alive
*!*	ENDDO
*!*	Clear dlls
*!*	Erase (sys(5)+curdir()+lcTemp+".*")
*!*	if !empty(lcAlias) and used(lcAlias)
*!*		select (lcAlias)
*!*	endif
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform