Example grid report template—CCREGN job sample Chunk text using DSC
-
Create the following file and name it CCREGN-Job-Sample-Grid.tpl.
CCREGN-Job-Sample-Grid.tpl
{!-- Datasource-Aliases: RSSampleSearch, JOBSAMPLE --}
{.loop in $JOBSAMPLE as $JS}
{$JS.S_NAME}
{.onEmpty}
No sample data found.
{/loop}Since this report template is to create a report of the samples in a job in the CCREGN—Job Update application, then the RSSampleSearch data source is, by default, available to the report template. The report template also uses the JOBSAMPLE data source, so a DSC file is required to build it. Therefore the template comprises the TPL file and the DSC file, that is, a ZIP file containing both these files.
Note: Even though all records returned from a search may not be downloaded to the form, the grid report result set contains all returned records, and not just those displayed on the form.
-
Create the following file and name it CCREGN-Job-Sample-Grid.dsc.
CCREGN-Job-Sample-Grid.dsc
<?xml version="1.0" ?>
<SQL>
<SQLQUERY>
<SQLTABLE>JOBSAMPLE</SQLTABLE>
<SQLCOMMAND>
select
S.NAME as S_NAME
from
CCSAMPLE S
where
((trim(:GRIDCODE) is null and S.CODE like '%') or (trim(:GRIDCODE) is not null and S.CODE in (:GRIDCODES)))
{{ and S.ORGANISATION_CODE = (^organisationCode)}}
{{ and S.LABORATORY_CODE = (^laboratoryCode)}}
</SQLCOMMAND>
</SQLQUERY>
</SQL> -
Zip the CCREGN-Job-Sample-Grid.tpl and CCREGN-Job-Sample-Grid.dsc file to create CCREGN-Job-Sample-Grid.zip file.
-
Create the following report template using the CCTPLR—Report Template application:
Organisation Scope: Selected
Report Template Code: CCREGN-JOB-SAMP-1
Name: CCREGN Job Sample Update Grid
Is Active: Selected
Type: 00—Grid
File: Upload the CCREGN-Job-Sample-Grid.tpl file
Report Engine: 03—Text
Default Output Format: TXT—Text
Output File Name: CCREGN_Samples.txt
-
Create the following application preference using the CCPREF—Preference application:
Scope: Instance, or other scope to restrict the report template availability when performing the export to report.
Preference Name: SEARCH_REPORT_CCREGNSAMP
Description: Job update - sample reports available
Setting Type: STRING
Setting Value: Add CCREGN-JOB-SAMP-1:Job update samples grid to the comma-separated list of available templates.
Preference Type: PREFERENCE
Is Active: Checked
-
Open a job in the CCREGN—Job Update application and select the Samples tab.
-
Click Export to report to open the Export to Report dialog and enter the following report details:
Report Template Code: CCREGN-JOB-SAMP-1
Download: Selected
-
Click OK to generate the grid report.
The RSSampleSearch result set is provided from the CCREGN—Job application to the report template.
The JOBSAMPLE result set is built by the DSC.
-
Click the Click to download button, then click the button showing the name of the downloaded file to open and view the report.
