Requirements: Listing serial numbers in Crystal Reports header section.
Generate an ado.net file.
Open Crystal->Select reports page header and insert a subreport. When prompted to select ado.net datasource, use parents.
Parent Report->Insert Report->Subreport->New Report Name->xxx->Report Wizard->Create New connection->Ado.net->File Path->ado.net file above->Select and move ReportDataSet to right pane.
Parent Report->Subreport->right click->Change Subreport links->Available Fields->JobHead.JobNum->JobAsmbl.AssemblySeq->Move to right pane.
Parent Report->Subrerport->Double Click->Open subreport for editing.
To accumulate the serial numbers for each group and assembly, the subreport must be grouped on these fields.
Open subreport->Insert->Group->Job num
Open subreport->Insert->Group->Asmbl seq
Delete both group name boxes, and all other subreport boxes created by default. Report should now be empty of all boxes.
Create a global variable to store the alpha-numeric serial numbers. Normally each new serial number would be appended to this variable
and the job number footer would display the accumulated list. The requirements on this report require only the first and last
serial numbers. Create a global variable for each of them. Create a function to create these variables.
Subreport->Field explorer->Formula fields->Right Click->new->SerialCreate
Shared StringVar SerialNumberStart;
Shared StringVar SerialNumberEnd;
SerialNumberStart := "";
SerialNumberEnd := "";
Save function and drag to JobNum group header. Crystal will execute this function on each group header, both strings contents are cleared.
Save function and drage to JobNum group header. Crystal will execute this function on each group header, both strings contents are cleared.
Save the serial numbers by creating a new function which is called for every report detail record. if the start serial number is empty, the
newly encountered serial number is stored, all other serial number overlay the end serial number resulting in the last being printed on the report.
Shared StringVar SerialNumberStart;
Shared StringVar SerialNumberEnd;
if SerialNumberStart = "" then SerialNumberStart := {BAQReportResult.SerialNo.SerialNumber};
SerialNumberEnd := {BAQReportResult.SerialNo.SerialNumber};
Drag this function to the subreports details section
Create another function to print the accumulated strings.
Shared StringVar SerialNumberStart;
Shared StringVar SerialNumberEnd;
if SerialNumberEnd = "" then SerialNumberStart;
else SerialNumberStart + "-" + SerialNumberEnd
Drag function to JobNum group footer, Suppress (no drill down) all reports sections except this JobNum group footer.
Epicor generated ado.net datasets create a new record for each serial number, all of which show up in the main reports details section.
They can be removed by creating groups, including all extranious detail the hidden details section, and then moving the detail output generation
to one of the group footers. See
Concatinating text from multiple ado.net BAQReportResult records into single Crystal Reports field for more details.