Seagate : Multiple Recordsets in a single report.


 Hi,

   I am working with Seagate Crystal Report 8.0.1
   I am using the Crystal report on the Web.
   I have a ttx file called "ReportHeader" and
   another ttx file called "ReportContent".
   My COM object returns 2 recordsets one for
   each ttx file. Everything works fine if i make
   the "ReportContent" as a subreport. But if i tried
   to use both the ttx file in a single report
   the "ReportContent" doesnot show any value.
   I added thest two ttx file as 2 tables in my
   report. There is no link between them.  Here is my asp code.

   First recordset has only one record in it.
   Second one has 277 records in it. But it's not
   getting displayed. Cant i use more than one
   recordset in a report ???

-------------------------------------------------------------------

session("oRpt").DiscardSavedData

' Creates RtDbBus object
Set session("oRtDbBus") = Server.CreateObject(rtDbBus)
' Calls Generate Method
Call session("oRtDbBus").Generate(arrParams,resultSets)

' Creates session object for each resultset returned by the Generate method
For index = 0 to UBound(resultSets)
     Response.Write(" ResultsetRowCount : " & resultSets(index).RecordCount & "<BR>")
     Set session("oRs" & (index+1)) = resultSets(index)
Next

Set Database = session("oRpt").Database
If index > 0 then
     Dim intTablesCount
     Dim intTableIndex
     
     ' Get the Main tables count
     intTablesCount = Database.Tables.Count

     ' Sets Resultsets for the main tables
     For intTableIndex = 1 To intTablesCount
          Database.Tables.Item(intTableIndex).SetPrivateData 3,  session("oRs" & intTableIndex)
     Next

     ' Set the resultset for subreports.
     Set crpSections = session("oRpt").Sections
     For Each crpSection In session("oRpt").Sections
          For Each rptObject In crpSection.ReportObjects
               If rptObject.Kind = 5 Then
                    Set crpSubreportObject = rptObject
                    Set crpSubreport = session("oRpt").OpenSubreport(crpSubreportObject.SubreportName)
                    Set crpDatabase = crpSubreport.Database
                    Set crpDatabaseTable = crpDatabase.Tables.Item(1)
                    crpDatabaseTable.SetPrivateData 3, session("oRs" & intTableIndex)
                    intTableIndex = intTableIndex + 1
               End if
          Next
     Next
End if
 
-------------------------------------------

 Thanks,

 Sankar S.
LVL 1
sankars98Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
DRRYAN3Connect With a Mentor Commented:
In your query which creates the recordset, add a static value

select "AA" as DummyField, field1, field2 from table

then setup the first group as normal, basing it on the DummyField from your query.  Since this value never changes it will not impact the groupings performed by subsequent groups and will let you put a page header on each page as described above.

DRRYAN3
0
 
DRRYAN3Commented:
The official line from CrystalDecisions is that multiple TTX files in one report is not recommended because of the inability to link the tables together and the lack of indexes.  See link for more info:

http://support.crystaldecisions.com/kbase/c2007228.asp

A few other thoughts:

If you have only one record in your header can't you incorporate those fields into your detail recordset for reporting purposes?

I have always tried to get a single recordset or table created on which to report.  It sometimes takes a little more processing, but the reports are much easier to design, even if you have to resort to sub-reports for detail data.
0
 
sankars98Author Commented:

 Thanks for the response, DRRYAN3.

> I have always tried to get a single recordset or table
created on which to report.  It sometimes takes
> a little more processing, but the reports are much easier to design, even if you have to resort to sub-reports for detail data.

 That's how initially i designed my reports. The problem
 with that approach is Subreports headers are displayed
 only on the first page. It's not getting displayed on the
 second page onwards. Is there anyway to say the crystal report to display the subreport headers in all the pages ?

Thanks,

Sankar S.
0
 
DRRYAN3Commented:
You could insert a dummy group in your subreport and on the Change Group dialog, check the box indicating that the group header is to be repeated on each page.

DRRYAN3
0
 
sankars98Author Commented:

 DRRYAN3, Thanks for the reponse. I am really new to
 this crystal report area. So, can you please tell me
 how to insert a dummy group to a report ? I looked
 at the help file and tried to insert a group. It seems
 the value for the group comes from the recordset
 itself. I dont know how to insert a static header group
 field.

Thanks,

Sankar S.
 
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.