[Serializable]
public class WorkOrder
{
public long WorkOrderId { get; set; }
public virtual ICollection<
WorkOrderItem
> WorkOrderItems { get; set; }
}
[Serializable]
public class WorkOrderItem
{
public long WorkOrderItemId { get; set; }
public long WorkOrderId { get; set; }
public int Type { get; set; }
}
Each subreport selects from the table WorkOrderItems. The subreport that does not repeat records has a select statement of
SELECT * FROM WorkOrderItems
WHERE (Type = 2)
ORDER BY StartDate
The subreport that repeats has a select statement of
SELECT * FROM WorkOrderItems
WHERE (Type = 1 OR Type = 3) AND (Quantity > 0)
ORDER BY Type DESC
The subreport contains a table that lists all WorkOrderItems. If there are 5 items in the query, the subreport is displayed 5 times. If there are 2 items, the subreport is displayed 2 times. I can tell the subreport is being called multiple times because I get the complete header. Also, I get an extra record in the table that contains no data.
This is a huge project and I can post some code if needed, but it would take quite a bit of work to pare it down. And then who knows if the error will disappear or not.
This is all being used in an MVC project to show the report as a PDF to the user. Here is the code I am using to generate the report.
WorkOrder workOrder = Repository.WorkOrderByKey(id);
ReportWorkOrder report = new ReportWorkOrder();
report.DataSource = workOrder;
ReportProcessor reportProcessor = new ReportProcessor();
RenderingResult result = reportProcessor.RenderReport("PDF", report, null);
return File(result.DocumentBytes, "application/pdf", "WorkOrder.pdf");
Any help would be greatly appreciated.
Thanks