Link to home
Start Free TrialLog in
Avatar of jruhe
jruheFlag for United States of America

asked on

Crystal XI Viewer & VFP

Hello Experts,

I'd like some sample code that uses the Crystal Viewer for VFP.  Additionally, I'd like to know which DLL's it uses.

Thanks!

jr
Avatar of Olaf Doschke
Olaf Doschke
Flag of Germany image

From the descriptions of the Crystal Report Viewer you can only view/use Crystal Reports with it, not a database.

Bye, Olaf.
Avatar of Mike McCracken
Mike McCracken

What viewer are you referring to?

Do you have CR XI/
if so which edition?

mlmcc
What viewer are you referring to?

Do you have CR XI/
if so which edition?

mlmcc
Here are some samples in vb with the correct controls:
http://www.crincode.com

Mark
ASKER CERTIFIED SOLUTION
Avatar of Olaf Doschke
Olaf Doschke
Flag of Germany 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
that viewer only works if the data is saved with the report.  it cannot update the information to reflect the surrent data unless you have one of the enterprise Crystal or BO tools.

mlmcc
Avatar of jruhe

ASKER

Sorry guys.  I think there's something wrong with my email notifications.  I got the message that said the question was dormant, but no the ones that told me you had possible solutions.

mlmcc, I have the Developer's edition.  I was using Crystal 8 and now they're moving to XI.  basically, in the past, I would dump data to a temporary table (DBF), then I'd print off of it using the Viewer control.  I'd like to approximate the same thing.

I've attached the old code.  Hope I didn't miss anything.

jr
PARAMETERS V_CRFILE,V_TABLE,V_OUTFILE,V_OUTTYPE
PRIVATE V_CRFILE,V_OUTFILE,V_OUTTYPE,V_RTN
WAIT WINDOW [Generating Preview. . .] NOWAIT
IF ! ([\] $V_CRFILE)
	mDir =RTRIM(a_sycins.Idosdbf)
	V_CRFILE =mDir +V_CRFILE
ENDIF
IF TYPE([crApp]) ="O"
	RELEASE crApp, crReport
ENDIF
IF FILE(V_CRFile) AND FILE(V_Table)
	crApp=createobject("crystalruntime.application.8")
	crReport=createobject("crystalruntime.report.8")
	crReport=crApp.openreport(v_crfile)
	crReport.Database.Tables.Item(1).Location	=v_table

	crReport.ReadRecords

	DO FORM vw_cryst
	WITH vw_cryst
	.addobject('crviewer1','olecontrol','crviewer.crviewer')
	.temp_db_name=v_table
	.v_crfile=v_crfile
	.v_table=v_table
	WITH .crViewer1
	.height=vw_cryst.height -29* 
	.height	=vw_cryst.height
	.width=vw_cryst.width
	.EnableExportButton=.T.
	.visible	=.t.
	.reportsource=crReport
	.ViewReport
	=MESSAGEBOX("Processing completed.  You may view the report, or you may print from the preview window.")
	ENDWITH
	ENDWITH
ELSE
	V_Rtn	=.F.
	=MESSAGEBOX("Missing Crystal report or Fox2x table! ",48,"CrystFox")
ENDIF

Open in new window

The same or similar code should work with CR XI.

This may help because I think you are using the OCX viewer from CR8
http://www.sdn.sap.com/irj/boc/index?rid=/library/uuid/d0266ff1-261f-2b10-0284-e45e1568431e

mlmcc
Avatar of jruhe

ASKER

OK that article seems like it's going to help, but it's been a while since I've done this and I can't find where you "add a reference" (VB-speak) in VFP.  when I issue the command:
crApp=createobject("CRAXDRT.Application")

I get the following error:
Class Definition CRAXDRT.Application is not found

And I think I need to add a reference, but I don't know how to do that. . .

Thanks,
Joy
I don't know VFP so I don't know either.

This may be useful.  You will need to scroll down a bit.  There is a link about 2/3 of the way down to code for vfp.

http://forums.sdn.sap.com/thread.jspa?threadID=892036

mlmcc
Avatar of jruhe

ASKER

OK guys.  The document that you provided, mlmcc, looks like it would be very helpful, but it doesn't say exactly which com objects to register.  So I went to a VB progam for another client and found that I should register the Crystal Reports ActiveX Designer Run Time Library.  On the other client, it was 11.5.  I only have the 11.0 version for the client I'm working on now, the VFP client.

However, when I "registered" (added to the object browser) the CRAXDRT object, and then I use the following command (similar to the "Dim crApp As CRAXDRT.Application" command in VB), I get the attached error message.   User generated image
Any ideas?  (FYI, I'm going to the Caribbean on a job this week and won't be on-line much due to not having internet in the hotel, but I'll be checking through the week-end and I'll circle back next week)
Avatar of jruhe

ASKER

I'm going to start another question just in case we have some VFP expert's out there, but I would like your feedback too please.  I feel like we're very close.
It would seem to mean there needs to be a class definition file for CRAXDRT .  I don't think there is a VFP module you can use.

mlmcc
Avatar of jruhe

ASKER

Right.  Please see https://www.experts-exchange.com/questions/26655759/VFP-Object-Browser-CREATEOBJECT-CRAXDRT-Crystal.html for the drill-down in that CRAXDRT file, and note that the following command works in VB:

Dim crApp As CRAXDRT.Application

Thanks again,
jr
Crystal has dropped support for CR 11 R1.  You might try to download CR XI R2.

http://www.sap.com/usa/solutions/sapbusinessobjects/sme/freetrials/index.epx

mlmcc
Avatar of jruhe

ASKER

FYI the client is going to add R2 this coming week while I'm away.  Hang tight--I'll be in touch the week of the 6th.  Thanks very much.
Avatar of jruhe

ASKER

The client installed Crystal XI R2 Developer edition while I was gone.  She said she installed all of the options, but now the 11.5 objects aren't listed in the Object Browser, but the 11.0 objects are still listed there.  And, if you use one of those 11.0 libraries, it gives the error message that "the selected file is either invalid or not a type library."  Besides which, isn't R2 supposed to show 11.5?  Where is craxdrt.dll anyway?  It's not in the windows\crystal directory. . .

jr
SOLUTION
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
Avatar of jruhe

ASKER

thanks mlmcc.  Hate to drag this out, but I will need to check again on Thursday with the client.  Will let you know.  (FYI, today the client said she got the command crApp=createobject("CRAXDRT.Application" to work by manually browsing for the DLL.  Oddly, when I do that, it doesn't work; however, Olaf gave a good idea today, in another thread--I will check that out as well).

jr
Avatar of jruhe

ASKER

Thanks for your hard work.

jr
Avatar of jruhe

ASKER

Followup:  to those who may have this issue in the future, in VFP, go to Tools / Options, then the Controls tab.  Click the ActiveX option, choose the Controls checkbox, then check Crystal ActiveX Report Viewer Control 11.5 (although in my Object Browser it showed the incorrect version of the Viewer Control, here in the Options window all the versions are correct).  To keep this change whenever you invoke VFP in the future, click the Set As Default button before clicking OK.

The code above should work (minus the ".8" in the CREATEOBJECT commands).  If upgrading to XI from a previous version and you have reports with DBF data sources, first run one of those reports in XI in order to install the correct driver (p2ixbse.dll, I believe).  No need to save the report--XI will run an older report.  This will update the driver and all like reports should work.

Cheers