Doktor0_8

I have a windows application made in VB.NET 2005. I have generated a Main-report with one linked subreport. The Reports are linked on a field called DISPREGNO. DISPREGNO is a DECIMAL in both tables.

The data is captured from a dataset containing 2 datatables in a "one to many" relationship. The Reportheader uses datatable1 and the ReportItem use datatable2. When I try to genereate the Main-report (reportheader), data from datatable1 is showed correctly - but data from datatable2 is missing in the subreport. During debugging I can see that all data is correctly placed in datatable2. When I in the same Method generete the sub-report as a Mainreport, the data is shown correctly - derived from datatable2.

It seems that Crystal Report cant filter the data for the subreport on basis of the Mainreport. Where is my bug I hope some one can help me.



Re: Crystal Reports for Visual Studio Crystal Report Empty subreport

Mauli Shah - MSFT

Moved to "Crystal Reports for Visual Studio" forum.





Re: Crystal Reports for Visual Studio Crystal Report Empty subreport

Manish Joisar

Have you linked your sub report with Main report

Right click on Subreport -> Change subreport links...

In this just match the column which you want to link between sub report & main report

Hope it hleps






Re: Crystal Reports for Visual Studio Crystal Report Empty subreport

Doktor0_8

Yes - the subreport is linked to the mainreport - the bug is not here. Im still searching for the solution...





Re: Crystal Reports for Visual Studio Crystal Report Empty subreport

captJackSparrow

Check one more place,

Under Field Explorer > DataBase Fields > Right Click "Visual Linking Expert" > a window with Link Tab will open, there you should see the two tables and link them with the filed ( i mean that decimal field, Joint Master table with detail table).

Also in which section you have placed your sub-report.Place it in detail section.





Re: Crystal Reports for Visual Studio Crystal Report Empty subreport

Manish Joisar

Can u tell me what is sequence of setting datasource to main report & sub reports

Long ago i also get something like this when i set datasource of Main report 1st & sub reports later

Hope it helps






Re: Crystal Reports for Visual Studio Crystal Report Empty subreport

Doktor0_8

Here is my Code:

Private Sub CreateAttachmentFile(ByVal FileName As String, ByVal ReportType As Integer)

'The parameter "ReportType" is for future use

AttachmentGenerator.DeleteFile(FileName)

'Create one Loading-instruction per. truck

Dim rptLoadingInstruksHeader As rptLoadingInstruksHeader = New rptLoadingInstruksHeader

Dim rptLoadingInstruksItem As rptLoadingInstruksItem = New rptLoadingInstruksItem

rptLoadingInstruksItem.SetDataSource(dtReportItems)

rptLoadingInstruksHeader.SetDataSource(dtReportHeader)

rptLoadingInstruksHeader.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, FileName)

cptReportViewer.ReportSource = rptLoadingInstruksHeader

'The following code is only for test - makes af Main-Report on basis of the subreport

rptLoadingInstruksItem.SetDataSource(dtReportItems)

rptLoadingInstruksItem.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, FileName & "A")

End Sub

As you see - the Items is created before the header - and it dont work....




Re: Crystal Reports for Visual Studio Crystal Report Empty subreport

Doktor0_8

Hi CaptJackSparrow

I cant find the option "Visual Linking Expert". When I in my MainReport (or in my subReport) look at Field Explorer -> Database Fields I only have my dataTable including its Fields. When I rightclick any of these I cant find "Visual Linking Expert". But I have linked the data in the 2 datatables witch are in my dataset. I have also linked my subreport to the Mainreport....





Re: Crystal Reports for Visual Studio Crystal Report Empty subreport

Manish Joisar

What we are doing when attaching datasource to Main Report & Sub Report

Dim Report1 As New CrystalReport1

Dim Report2 As ReportDocument = Report1.SubReports(0)

Report2.SetDatasource(DsData.Tables(1))

Report1.SetDatasource(DsData.Tables(0))

Hope it helps






Re: Crystal Reports for Visual Studio Crystal Report Empty subreport

Doktor0_8

You are the BEST

IT WORKS - GREAT

My code looks now as follows:

Private Sub CreateAttachmentFile(ByVal FileName As String, ByVal ReportType As Integer)

'The parameter "ReportType" is for future use

AttachmentGenerator.DeleteFile(FileName)

'Print one Loading-instruction per. truck

Dim rptLoadingInstruksHeader As rptLoadingInstruksHeader = New rptLoadingInstruksHeader

Dim rptLoadingInstruksItem As CrystalDecisions.CrystalReports.Engine.ReportDocument = _ rptLoadingInstruksHeader.Subreports(0)

rptLoadingInstruksItem.SetDataSource(dtReportItems)

rptLoadingInstruksHeader.SetDataSource(dtReportHeader)

rptLoadingInstruksHeader.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, FileName)

End Sub

Thank you