I have a report (Report1) with a SubReport (SubReport1). I need the subreport (SubReport1) to be populated from a query that takes a value from the record in the main report (Report1).
I am passing RecordSet from VB.Net code to the report.
This is the example to pass the recordset.
[Visual Basic]
Public Sub CreateRecordSetExample()
Dim MyReport As New DocumentLayout(MyFilePath)
Dim MyQuery As Query = MyReport.GetQueryById("Query1")
AddHandler MyQuery.OpeningRecordSet, AddressOf Query_OpeningRecordSet
Dim MyDocument As Document = MyReport.Run()
MyDocument.Draw("C:\Temp\report.pdf")
End Sub
Private Sub Query_OpeningRecordSet(ByVal sender As Object, ByVal e As OpeningRecordSetEventArgs)
Dim MyObjectList As New ArrayList()
MyObjectList.Add(New CustomObj(1, "One"))
MyObjectList.Add(New CustomObj(2, "Two"))
MyObjectList.Add(Nothing)
MyObjectList.Add(New CustomObj(3, "Three"))
MyObjectList.Add(New CustomObj(4, "Four"))
args.RecordSet = New EnumerableRecordSet(MyObjectList)
End Sub