I’m having an issue with printing OrderAck reports for orders with high line counts. They tend to timeout before completing.
After a lot of digging, it appears that the subreport SOForm_OLMscCharges
is to blame.
When I remove that subreport, a 184 line Order takes a few seconds to render. With that subreport in, it times out. And this Order has no Misc Charges!
Opening the subreport in Report builder and previewing it, it takes about 30 seconds to complete - to just return no records.
So at 30 seconds per order line, that 180 line report would take 90 minutes to complete.
Running the subreport’s query query expression in SSMS, yields that it returns 31,000 rows. Again, this report has no Misc Charges (neither line nor header).
Copying the results from SSMS to Excel, shows that there are multiple records for each Order Line - I would have thought there would be one per MscCharge (so in my case zero records). I get 176 records per Order Line (8 shy of the 184 lines in the order).
I now see that the OrderNum field is coming up 'Null`
Here’s the SQL query
SELECT T1.OrderRelNum,T1.OrderLine,T1.ReqDate, T2.OrderLine as OrderMsc_OrderLine,T2.MiscCode,T2.OrderNum,T2.DocMiscAmt, _over_400_more_fields_not shown_
FROM OrderRel_a23558f6332a45a2a68d03479f221838 T1
LEFT OUTER JOIN OrderMsc_a23558f6332a45a2a68d03479f221838 T2
ON T1.Company = T2.Company AND T1.OrderLine = T2.OrderLine AND T1.OrderNum = T2.OrderNum
JOIN OrderHed_a23558f6332a45a2a68d03479f221838 T3
ON T1.OrderNum = T3.OrderNum AND T1.Company = T3.Company
JOIN RptLabels_a23558f6332a45a2a68d03479f221838 T4
ON T4.RptLanguageID = T3.RptLanguageID LEFT OUTER JOIN OrderDtl_a23558f6332a45a2a68d03479f221838 T5 ON T3.Company = T5.Company AND T3.OrderNum = T5.OrderNum
LEFT OUTER JOIN FSContDt_a23558f6332a45a2a68d03479f221838 T6 ON T2.Company = T6.Company AND T2.OrderLine = T6.OrderLine AND T2.OrderNum = T6.OrderNum
The Report’s dataset does use filters,
so none of these fields display, but they all are returned for every Order Line.
Seems like the RDD makes a bad OrderMsc_<GUID>
table.