title: Crystal Reports, Link Subreport To Date Group
body: <p>I am trying to create a report to show our overall quality tending over time by month or quarter (over a span of several years).  The main report will show all of our shipments over the specified time period grouped by month/quarter, and the sub report will show all returns entered during that month/quarter that result in scrap or rework.</p>
  
  <p>The issue I am having is linking the sub report to the date group in the main report.  After several attempts using different methods, the best I could do is show all returns within the date parameter in every group footer.</p>
  
  <p>This is my first time posting, so I'm not sure what additional info will be needed to assist.  Please let me know if there is more needed.</p>
  
  <p>*Edit for additional info</p>
  
  <p>I would like the subreport to show data for each month or quarter in the given time period.  So if the date range of the report is for 1/1/2018 - 9/30/2018 and the data is grouped by month, I would like the subreport to show only the data from each month group.  General layout below.</p>
  
  <p><strong>January</strong><br>
  Shipments<br>
  Returns (subreport showing data for January)  </p>
  
  <p><strong>February</strong><br>
  Shipments<br>
  Returns (subreport showing data for February) </p>
  
  <p>*Second edit to add screenshot and more info</p>
  
  <p>I stripped all the parameters from the subreport because I couldn't get any of them to work.  The only parameter on the main report is the Date Range that prompts users for a start and end date.</p>
  
  <p>The main report has the shipments in the details section.</p>
  
  <p>Current layout below.  If I can get this current issue resolved, I will be adding values passed up from the subreport to calculate the quality rating for each month, then passing them back down to a second subreport to summarize and chart.</p>
  
  <p><a href="https://i.stack.imgur.com/SdWsZ.png" rel="nofollow noreferrer">Quality Trend Layout</a></p>
  
  <p>*Third edit for data source and example data</p>
  
  <p>The main and subreports are pulled from tables in our company database.</p>
  
  <p>SQL query used for the main report.  Only the "Releases" table is used to show how many and when each part was shipped.  <code>DelType=0</code> is specifying a customer delivery.  The date range is defined by a user entered parameter.</p>
  
  <p><strong>Main Report</strong>  </p>
  
  <pre><code>SELECT 
  "Releases"."DateComplete",  
  "Releases"."DelType",  
  "Releases"."PartNo",  
  "Releases"."Qty",  
  "Releases"."JobNo",  
  "Releases"."PartDesc"  
  
  FROM   "COMPANY"."dbo"."Releases" "Releases"  
  
  WHERE  "Releases"."DelType"=0 AND  
  ("Releases"."DateComplete"&gt;={ts '2018-01-01 00:00:00'} AND  
  "Releases"."DateComplete"&lt;{ts '2018-10-01 00:00:00'})  
  </code></pre>
  
  <p>I am trying to use <code>CustReturn.DateEnt</code> as the datetime link to <code>Releases.DateComplete</code> in the main report (not currently linked at a paramter because it didn't work), and only select records that are customer returns resulting in rework, scrap, sort, or repair.</p>
  
  <p><strong>Subreport</strong>  </p>
  
  <pre><code>SELECT 
  "CustReturn"."DateEnt",  
  "CustReturn"."CustRMANo",  
  "CustReturnDet"."OrigJobNo",  
  "CustReturnDet"."PartNo",  
  "CustReturnDet"."QtyReturned",  
  "CustReturnDet"."QtyToRework",  
  "CustReturnDet"."QtyToRestock",  
  "NonConformance"."Disposition",  
  "NonConformance"."ReturnType",  
  "CustReturn"."IssueDate",  
  "NonConformance"."NonConfDate",  
  "CustReturnDet"."PartDesc"  
  
  FROM   
  ("COMPANY"."dbo"."CustReturn" "CustReturn" INNER JOIN "COMPANY"."dbo"."CustReturnDet" "CustReturnDet" ON "CustReturn"."CustRMANo"="CustReturnDet"."CustRMANo")    
  LEFT OUTER JOIN "COMPANY"."dbo"."NonConformance" "NonConformance" ON "CustReturnDet"."NonConfNo"="NonConformance"."NonConfNo"
  
  WHERE  ("NonConformance"."Disposition"='REPAIR' OR  
  "NonConformance"."Disposition"='REWORK' OR  
  "NonConformance"."Disposition"='SCRAP' OR  
  "NonConformance"."Disposition"='SORT') AND  
  "NonConformance"."ReturnType"='CUSTOMER'
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/rgNvX.png" rel="nofollow noreferrer">Quality Trend Example Data</a></p>