p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

crystal_reports thread: crp with ttx files and recordset


Message #1 by "Vinod" <vkyachareni@r...> on Wed, 20 Jun 2001 17:13:33
Hi all,



I am looking to generate crystal reports based on ttx files. I want to 

retrieve the data from a recordset. Can anyone suggest me as how should i 

link the Recordset to ttx files.



Please NOTE:- I dont want to generate the TTX files based on recordset. i 

want to view a report which is based on ttx file and gets the data from 

recordset.



Thanks In Advance,



Vinod
Message #2 by kirsten@l... on Thu, 21 Jun 2001 08:52:55
> Hi all,

> 

> I am looking to generate crystal reports based on ttx files. I want to 

> retrieve the data from a recordset. Can anyone suggest me as how should 

i 

> link the Recordset to ttx files.

> 

> Please NOTE:- I dont want to generate the TTX files based on recordset. 

i 

> want to view a report which is based on ttx file and gets the data from 

> recordset.

> 

> Thanks In Advance,

> 

Hi there

We've done exactly the same thing using disconnected recordsets in VB6.

You have to make sure that the recordset that you build has the exact same 

fieldnames with the same datatypes as the ttx file.  The fieldnames must 

also be in the same order as the fields in the ttx file else you will get 

mixed up data in your report.  Then all you do is pull the data you want 

to the recordset and set the datasource of your report (which will have 

been based on the ttx file) to your recordset.  It seems to work well like 

this.

Cheers Kirsten
Message #3 by "fred ahsmann" <fred.ahsmann@v...> on Thu, 21 Jun 2001 10:11:42 +0200
I asume that you want to create at runtime a report, and add a table to

this report

based on a ttx.



There are 2 ways to accomplish this task:



1. Create a report based on the P2SMON.DLL

This DLL is the data driver for the active data. You can use the exposed

method

in this DLL for achieving your taks:



Private Declare Function CreateReportOnRuntimeDS Lib "p2smon.dll" ( _

    lpUnk As Object, ByVal reportFile As String, ByVal fieldDefFile _

    As String, ByVal bOverWriteFile As Long, ByVal bLaunchDesigner _

    As Long) As Long





Private Function createReportFromTtx (ttxFile As String, reportName As

String) as craxdrt.report

    Dim crapp           As CRAXDDRT.Application

    Dim myRs            As New ADODB.Recordset



    Set myRs =3D getAdoRsFromTtx(ttxFile)



    CreateReportOnRuntimeDS myRs, reportName, ttxFile, 1, 0

    Set myRs =3D Nothing

  

    Set crapp =3D New CRAXDDRT.Application

    Set createReportFromTtx =3D crapp.OpenReport(reportName)

    Set crapp =3D Nothing=09

End Function



2. Create a report based on the Report Creation API (CRAXDDRT.DLL)

Private Function createReportFromTtx (ttxFile As String, reportName As

String) as craxdrt.report

    Dim crApp As New CRAXDDRT.Application

    Dim adoRs As New ADODB.Recordset



    set adoRs =3D getAdoRsFromTtx(ttxFile)

   

    Set createReportFromTtx =3D crApp.NewReport

    Call createReportFromTtx.Database.Tables.Add("", , adoRs, ,

"p2smon.dll")

=09

    set crApp =3D Nothing

    set adoRs =3D Nothing



End Function



However, this last method generates some obscure Crystal Errors.



Fred





-----Original Message-----

From: Vinod [mailto:vkyachareni@r...]

Sent: Wednesday, June 20, 2001 7:14 PM

To: crystal_reports

Subject: [crystal_reports] crp with ttx files and recordset





Hi all,



I am looking to generate crystal reports based on ttx files. I want to

retrieve the data from a recordset. Can anyone suggest me as how should

i

link the Recordset to ttx files.



Please NOTE:- I dont want to generate the TTX files based on recordset.

i

want to view a report which is based on ttx file and gets the data from

recordset.



Thanks In Advance,



Vinod




  Return to Index