Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TTX File and Crystal Report in VFP 8.0

Status
Not open for further replies.

gsrajput

Programmer
Jan 10, 2002
25
US
Hi,
I 've created ADO Recordset and passed that to a crystal report. It works fine when I 'm in the development
mode and shows me the report preview fine. But when I compiled that to executable,I don't see any data in the report with the same selection criteria. I 've put messagebox to see if there 's any data in the recordset and it says valid # of matching records.
The report appears with blank data. I don't know what different it is doing in executable than development mode.



Please help.

Thanks in addvance.


G.

 
If you are creating the ADO recordset from Fox tables or after some Fox SQL then I would suspect that some global Fox setting is different between development and runtime environments. Are you setting things like SET EXACT and SET DELETED by explicit commands or are you relying on default values?

Geoff Franklin
 

G,

But when I compiled that to executable ...

Do you mean that you bound the actual report (RPT file) into the executable? Or the TTX file?

If so, I wouldn't expect that to work. The CR runtime needs those files, and it would have no way of finding them if they are bound into a VFP EXE.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Yes,I 'm creating recordset from fox tables. I 've created a crystal report on the basis of ttx definition file. There're no setting like set exact or set deleted and I confirmed recordset has the data by printing message.

Mike,
I 'm binding this report with the ado recordset data inside the executable. I hope I answered your question.

Thanks to both of you!!

G.
 

G,

In that case, you should try keeping the recordset outside the executable.

If that doesn't solve the problem, is there any reason why you decided to use ADO in the first place? CR can access VFP tables (and views) via the OLE DB provider, which I would think is much simpler.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Mike,
Thanks for your reply.

My client 've already designed the report with the ttx definition file and asked me to create the same thru the prog. I 've created so many other reports also like this but only difference this has parent and child table relation.
My curiosity is how come it works inside the vfp8. What different setting it has in executable. If not worked than I 'll do this with foxpro tables.

Thanks again!!

G.
 
What different setting it has in executable

You need to make sure that RunTime and Executable environments are identical. If you go to Tools/Options in Fox and press SHIFT+OK then all your settings will be copied to the Command Window (or Debug Output in VFP9) You can paste this code into your executable to replicate the settings you're running under in the development environment.

Just one last thought. Have you tried displaying dbf() in Wait Windows to make sure that the exe is reading the right data?

Geoff Franklin
 
Hi Craig,
Please see the code below.

Thanks!

G.



lcReportFile = "ReportTest.Rpt"
oCrApp = CREATEOBJECT("CrystalRuntime.Application")
oCRpt = oCrApp.OpenReport(lcReportFile)

oDbObj = oCRpt.Database()


oDbColObj = oDbObj.Tables()

oDbTable1 = oDbColObj.Item(1)

oDbTable1.SetDataSource(oRS1) && oRS1 is the header recordset
oDbTable2 = oDbColObj.Item(2)
oDbTable2.SetDataSource(oRS2) && oRS2 is the Detail recordset

IF oCRpt.HasSavedData
oCRpt.DiscardSavedData()
ENDIF
 
Ah...yeah...it doesn't work that way. Crystal doesn't have access to the data in VFP's memory space. The recordset needs to be passed as a parameter to Crystal Reports. There is an article on my web site that shows how to do it.

Craig Berntson
MCSD, Visual FoxPro MVP, Author, CrysDev: A Developer's Guide to Integrating Crystal Reports"
 
Hi Craig,
Thanks for your reply.
I looked the article written below (URL at the end) and noticed you 're also passing the recordset sameway unless I 'm looking different one.

I 've copied below lines from your Article.

* Get a reference to the DatabaseTable object for table 1
oDBT = ocDBT.Item(1)

* Pass the Record Set to Crystal Reports
oDBT.SetDataSource(oRS)
Please let me know, if there is any different article.

Thanks Much!!

G.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top