Hi,
I am currently trying to add a sub report to a parent report using vb script, however this can be done in c# script as well for examples.
I am currently following this: http://helpcentral.componentone.com/nethelp/AR7Help/OnlineEn/arWLKScriptForSubreports.html
Which unfortunately is not working for me.
I have created two reports, one a main report, one a sub report of the main.
I have then added this script into the main report to try and get the data from the sub report to show in the main report.
Dim rptSub As GrapeCity.ActiveReports.SectionReport
Sub ActiveReport_ReportStart
'Create a new instance of the generic report
rptSub = new GrapeCity.ActiveReports.SectionReport()
'Load the rpx file into the generic report
rptSub.LoadLayout(me.SubReport1.ReportName)
'Connect data to the main report
Dim connString As String = "ConnectionStringHere"
Dim sqlString As String = "QueryHere’"
Dim ds As new GrapeCity.ActiveReports.Data.SqlDBDataSource
ds.ConnectionString = connString
ds.SQL = sqlString
rpt.DataSource = ds
End Sub
Sub Detail_Format
Dim rptSubCtl As GrapeCity.ActiveReports.Subreport = me.SubReport1
Dim childDataSource As New GrapeCity.ActiveReports.Data.SqlDBDataSource
childDataSource.ConnectionString = "ConnectionStringHere"
'Set a parameter in the SQL query
childDataSource.SQL = "QueryHere"
'Pass the data to the subreport
rptSub.DataSource = childDataSource
'Display rptSub in the subreport control
rptSubCtl.Report = rptSub
End Sub
I apologies for being a bit vague, however not really sure on how I would implement this.
I am also unable to find any other references in people trying to achieve this, therefore I am asking this question.