Example grid report template—CCPRTN search Chunk text using DSC

  1. Create the following text template file and name it CCPRTN-Srch-Grid-using-GRIDCODES.tpl.

    CCPRTN-Srch-Grid-using-GRIDCODES.tpl

    {!-- Ventyx-Datasource-Aliases: RSSamplePortionSearch, SAMPLE_PORTION --}
    From the DSC:
    {.loop in $SAMPLE_PORTION as $SP}
    {$SP.NAME|onempty()|rpad(20)} {$SP.CLIENT_SAMPLE_NAME|onempty()|rpad(40)} {$SP.PORTION_CODE|onempty()|rpad(40)}
    {.onEmpty}
    No portion data found.
    {/loop}

    Since this report template is to create a report of the search results in the CCPRNT—Search Portion application, then the RSSamplePortionSearch data source is, by default, available to the report template. The report template also uses the SAMPLE_PORTION 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.

  2. Create the following DSC file and name it CCPRTN-Srch-Grid-using-GRIDCODES.dsc.

    CCPRTN-Srch-Grid-using-GRIDCODES.dsc

    <?xml version="1.0" ?> 
    <SQL>
        <SQLQUERY>
            <SQLTABLE>SAMPLE_PORTION</SQLTABLE>
            <SQLCOMMAND>
            select
                SP.JOB_CODE,
                SP.SAMPLE_CODE,
                S.NAME,
                S.CLIENT_SAMPLE_NAME,
                S.DESCRIPTION,
                SP.PORTION_CODE
            from
                CCSAMPLEPORTION SP
            inner join 
                CCSAMPLE S on 
                    SP.SAMPLE_CODE=S.CODE and
                    SP.JOB_CODE=S.JOB_CODE 
            where
                SP.LABORATORY_CODE = (:LABCODE) and
                SP.SAMPLE_CODE||'_'||SP.PORTION_CODE in (:GRIDCODES)
            order by
                SP.JOB_CODE,SP.SAMPLE_CODE,SP.PORTION_CODE
            </SQLCOMMAND>
        </SQLQUERY>
    </SQL>
  3. Zip the CCPRTN-Srch-Grid-using-GRIDCODES.tpl and CCPRTN-Srch-Grid-using-GRIDCODES.dsc file to create CCPRTN-Srch-Grid-using-GRIDCODES.zip file.

  4. Create the following report template using the CCPRTN—Portion application:

    Organisation Scope: Selected

    Report Template Code: CCPRTN-SRCH-1

    Name: CCPRTN Search Grid

    Is Active: Selected

    Type: 00—Grid

    File: Upload the CCPRTN-Srch-Grid-using-GRIDCODES.tpl file

    Report Engine: 03—Text

    Default Output Format: TXT—Text

    Output File Name: CCPRTN_Search_Results.txt

  5. 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_CCPRTN

    Description: Portion search reports available

    Setting Type: STRING

    Setting Value: Add CCPRTN-SRCH-1:Portions returned from search using GRIDCODES to the comma-separated list of available templates.

    Preference Type: PREFERENCE

    Is Active: Selected

  6. Enter search criteria in the CCPRTN—Search Portion application and click Search.

    Note: Until a search is performed, the Export to report button is unavailable. Entering new search criteria also makes this button unavailable.

  7. Click Export to report to open the Export to Report dialog and enter the following report details:

    Report Template Code: CCPRTN-SRCH-1

    Download: Selected

  8. Click OK to generate the grid report.

    The RSSamplePortionSearch result set is provided from the CCPRTN—Portion application to the report template.

    The SAMPLE_PORTION result set is built by the DSC.

  9. Click the Click to download button, then click the button showing the name of the downloaded file to open and view the report.