Skip to Content
0
Dec 02, 2021 at 06:27 PM

Linking Subreports using Command

125 Views

Problem:

I have created a report using the command function. I am trying to insert a subreport and link it to the billno field in the main report (?Pm-Command.billno). The code below is used in the command funtion of the main report and pulls all data within a given date range as well as any records related to the particular invoice(billno).

select b1.*
from billed b1
  inner join (
    Select billno, min(datebilled) as FirstDate
    from billed
    group by billno) dts
  on b1.billno = dts.billno
    and dts.FirstDate between {?BillDate} and {?enddate}

When inserting the subreport it is linked to command.billno with subreport parameter fields set to ?Pm-Command.billno and linked to the field tickc.billno

The subreport is not currently populating correctly it appears to be trippling some records and omitting others.

The subreport I would like to add does not use the command function when selecting records from the database.

Any help would be appreciated. Also please keep in mind if crystal reports was a person id still be in diapers.

screen-shot-2021-12-02-at-101828-am.png

mainreports-with-no-subreport-added.jpg

command-parameter.png

sub-report.png

mainreport-subreport.jpg