Pass data to subreport that is contained in another subreport
Hello,
I am working on creating report template for geocortex workflow. In this workflow I use TemplateReport activity in which I pass DataSet created in my custom activity. So my report gets DataSource as dataSet (I don't have any DB connections).
Report that I am creating has the next structure:
{
[some data, info, images]
subreport1: {
label with data
subreport2: { [info] }
}
}
In other words each subreport1 has nested subreport2.
Data to subreport1 are set by properties ( ReportName, Tag ) and it works fine. Each DataRow contains field Id.
Data to subreport2 are set in FetchData event in subreport1 - as I need to take array of elements with specific Id:
public bool ActiveReport_FetchData(bool eof)
{
DataDynamics.ActiveReports.SubReport rptSubCtl = ((DataDynamics.ActiveReports.SubReport) rpt.Sections["Detail1"].Controls["TestSubReport"]);
DataDynamics.ActiveReports.ActiveReport3 rptSub = new DataDynamics.ActiveReports.ActiveReport3();
rptSub.LoadLayout(@"C:\Program Files (x86)\Latitude Geographics\Geocortex Essentials\Default\REST Elements\Sites\VejenNewSite\Reports\ConflictMapsSubReport.rpx");
DataTable dt = (DataTable)((DataSet)rpt.DataSource).Tables["ConflictMapsData"];
int id = (int)rpt.Fields["Id"].Value;
System.Collections.Generic.List<DataRow> rows = new System.Collections.Generic.List<DataRow>();
foreach (DataRow row in dt.Rows)
{
if(id == Convert.ToInt32(row["Id"]))
{
rows.Add(row);
}
rptSub.DataSource = rows.ToArray();
rptSubCtl.Report = rptSub;
}
But generated pdf report isn't correct, some rows are missed and some were passed into improper subreport2.
On the next screen you can see that one row is missed (but should be there) in first subreport2:
/customer/servlet/servlet.FileDownload?file=00P6000000e885dEAA
on the next screen you will see that into subreport2 are passed rows with Id=3 but are drawed with Id=4:
/customer/servlet/servlet.FileDownload?file=00P6000000e885iEAA
For next test I've used subreport1 as root report and subreport2 as asubreport of first levele. The pdf was also corrupted, but in different place: there wasn't errors as described previously, but the last subreport should have 3 rows. but have only one.
/customer/servlet/servlet.FileDownload?file=00P6000000e885nEAA
Waiting for your help,
Thank you, Mykhaylo.
Du måste logga in om du vill lämna en kommentar.
Kommentarer
0 kommentarer