Creating a PDF Compound Report With Drill Through Links

In this section:

How to:

Reference:

A common technique in business reporting is to create two related reports:

Drill Through provides a way to easily relate the data in these two types of reports. For example, a user scanning a summary report account may see an unusual figure in one of the accounts, requiring examination of the specific data behind that figure.

There are two forms of Compound Drill Through reports:

In both types of Compound Drill Through reports, the syntax for creating hyperlinks between reports within the PDF file are exactly the same.

Reference: Drill Through and Drill Down Compared

Using Drill Down, you can construct a summary report in which clicking a hyperlink displays detail data. A Drill Down is implemented dynamically. Clicking a hyperlink causes a new report to run. The detail report typically displays only the detail data for a selected field on the summary report.

In contrast, Drill Through reports are static. Drill Through creates a PDF document that contains the summary report plus the detail report, with the detail report containing all the detail data for designated fields in the summary report. Clicking a Drill Through hyperlink navigates internally in the PDF file. No additional reports are run. You can save the PDF file to disk or distribute it using ReportCaster. When opened with Adobe Reader, it retains its full Drill Through functionality.

Drill Through provides flexibility in the appearance of reports and location of hyperlinks:

  • Drill Through hyperlinks may appear in headings and subheadings, as well as, in rows of data.
  • You can format the reports using a WebFOCUS StyleSheet.
  • You can indicate a hyperlink by color, font, underlining, and so forth.
  • You can mix conventional Drill Down hyperlinks freely in the same report with Drill Through hyperlinks.
  • The PDF file created with Drill Through can consist of more than two reports.

Reference: Use With Other Features

You can use Drill Through with other WebFOCUS features:

  • Compound reports that contain linked Drill Through reports may also contain unrelated reports, before or after the Drill Through reports. For example, you can add to the compound report package a PDF report that contains embedded graphs.
  • You can add Drill Down and URL hyperlinks to a PDF report that contains Drill Through hyperlinks.
  • Since Drill Through reports are standard PDF compound reports packaged into a single PDF file, you can distribute them using ReportCaster.
  • Reports with DRILLTHROUGH syntax can be rendered in all other styled output formats: HTML, PostScript, EXL2K, and so on. In these other formats, the DRILLTHROUGH syntax is ignored. It is useful, for example, to generate a PostScript version of a Drill Through report, which is formatted identically to the PDF version, but which you can send directly to a PostScript printer using ReportCaster or operating system commands.
  • Drill Through automates the process of navigating quickly and easily from general to specific information in related reports packaged in a single PDF compound report. Drill Through syntax sets up hyperlinks that take you from an item in a summary report to a corresponding item in a detail report.

Procedure: How to Create a Drill Through in a PDF Compound Layout Report

To create a Drill Through in a PDF Compound Layout report:

  1. Create the summary report with a DRILLTHROUGH hyperlink.
  2. Create the detail report with sort values that match the hyperlink field values.
  3. Create the Compound Layout report with page layouts for each component report, and define a DRILLMAP attribute within the calling report to specify the targets of the drill through hyperlinks.

Procedure: How to Create a Drill Through in a PDF Compound Report

To create a Drill Through in a PDF Compound Report:

  1. Create the summary report.
  2. Create the detail report.
  3. Connect the reports with hyperlinks.
  4. Merge the summary and detail reports into a PDF compound report.

Syntax: How to Specify Drill Through Hyperlinks

TYPE=type, [element,] [styling_attributes,]
     DRILLTHROUGH={DOWN|FIRST}(link_fields) , $

where:

type
Is one of the following StyleSheet types:
  • DATA
  • HEADING
  • FOOTING
  • SUBHEAD
  • SUBFOOT
  • SUBTOTAL
  • RECAP
element
Is one or more identifying elements allowed in a WebFOCUS StyleSheet and Drill Through report. An element can describe a specific column (for example, COLUMN=PRODUCT) or heading item (for example, LINE=2, OBJECT=field, ITEM=3).
styling_attributes
Optionally specify the appearance of the hyperlink (for example, COLOR=RED, STYLE=BOLD).
DOWN
Links to the next (the following) report.
FIRST
Links to the first Drill Through report in the sequence.
link_fields
Specifies blank-delimited link field pairs with the following format:
T1=S1 T2=S2 T3=S3...
T1, T2, and T3 represent column references in the target (linked) report, and S1, S2, and S3 represent column references in the source (current) report. There may be more than three pairs.

A column reference can be the name of a field or any of the other symbols valid in WebFOCUS StyleSheets syntax (for example, Bn, Cn, Pn, Nn, An, subscripted field name, and so on).

The order of the syntax is similar to Drill Down syntax, in which the parameter pairs specify the column reference in the current (source) report on the right and the name of the Dialogue Manager variable in the Drill Down (target) procedure on the left.

If the column reference in the target report is identical to the column reference in the source report, you can use a single column reference, for example, COUNTRY instead of COUNTRY=COUNTRY.

Example: Specifying Drill Through Hyperlinks

The following StyleSheet declaration places a hyperlink on the PRODUCT field on each DATA line, specifies that the fields to link to the next report are CATEGORY and PRODUCT, specifies the action DOWN, so that clicking a hyperlink brings you to the location in the next report that has the corresponding values of the two link fields, and uses the default appearance for the hyperlinks, which is blue, underlined text. Since the target fields in the detail report have identical names in the summary report, you can use the notation CATEGORY rather than CATEGORY=CATEGORY.

TYPE=DATA, COLUMN=PRODUCT, DRILLTHROUGH=DOWN(CATEGORY PRODUCT), $

Syntax: How to Specify Which Compound Layout Reports Will be Related Through Hyperlinks

The target report is specified in the DRILLMAP attribute of the COMPONENT declaration for the calling report.

DRILLMAP=((L1 targetreport))

where:

L1
Is the link identifier.
targetreport
Is the component name of hyperlink destination.

Note: The double parentheses around the DRILLMAP values are required.

Example: Sample Component Declarations With DRILLMAP Attributes

The following COMPONENT declaration for REPORT1 specifies a DRILLMAP attribute that points to REPORT2:

COMPONENT='REPORT1', TEXT='REPORT1', TOC-LEVEL=2, 
DRILLMAP=((L1 REPORT2)), POSITION=(0.750 1.083), DIMENSION=(7.000 3.167),
METADATA='Z-INDEX: 100; LEFT: 0.75in; OVERFLOW: auto; WIDTH: 7in;
POSITION: absolute; TOP: 1.083in; HEIGHT: 3.167in', $

The following COMPONENT declaration for REPORT2 specifies a DRILLMAP attribute that points to REPORT1:

COMPONENT='REPORT2', TEXT='REPORT2', TOC-LEVEL=2, 
DRILLMAP=((L1 REPORT1)), POSITION=(0.500 0.667), DIMENSION=(7.417 7.000),
METADATA='Z-INDEX: 100; LEFT: 0.5in; OVERFLOW: auto; WIDTH: 7.417in;
POSITION: absolute; TOP: 0.667in; HEIGHT: 7in', $

Reference: Usage Notes for Drill Through

  • As of Release 8.2 Version 01, individual component reports containing Drill Through designations can be run standalone. You will see a warning message in the Message Viewer indicating that outside of the compound report, the Drill Through will not be active.
  • Only one Drill Through behavior can be specified per report.
  • The field specified to contain a Drill Through behavior must also be present in the target report.
  • The originating report containing the Drill Through link must be rendered (by the Reporting Server) prior to the target report. The order of reports must be handled by the user.
  • Live Drill Through links are only generated for PDF output. Reports with DRILLTHROUGH syntax can be rendered in all other styled output formats: HTML, PostScript, EXL2K, and so on. In these other formats, the DRILLTHROUGH syntax is ignored. It is useful, for example, to generate a PostScript version of a Drill Through report, which is formatted identically to the PDF version, but which you can send directly to a PostScript printer using ReportCaster or operating system commands.
  • Drill Through is only supported for reports (TABLE).

Sample Drill Through PDF Compound Reports

Reference:

The following examples illustrate how to use Drill Through syntax to create a compound report with a summary and detail report and navigate between them.

Example: Creating the Summary Report (Step 1)

The following syntax generates a sample summary report:

TABLE FILE GGSALES
SUM UNITS DOLLARS BY CATEGORY BY PRODUCT
ON TABLE PCHOLD FORMAT PDF
END

The output is:

Example: Creating the Detail Report (Step 2)

The following syntax generates a sample detail report:

The first page of the output is:

SET SQUEEZE=ON
TABLE FILE GGSALES
SUM UNITS BUDUNITS DOLLARS
BY CATEGORY NOPRINT BY PRODUCT NOPRINT
ON CATEGORY PAGE-BREAK
HEADING CENTER
"Category: <CATEGORY"
" "
ON PRODUCT SUBHEAD
"**** Product: <PRODUCT"
ON PRODUCT SUBFOOT
" "
"<25 **** Return to Summary ****"
ON PRODUCT PAGE-BREAK
BY REGION BY CITY
ON TABLE PCHOLD FORMAT PDF
END

Example: Connecting the Reports With Hyperlinks (Step 3)

The example illustrates the following:

  • When you place a Drill Through hyperlink on a sort-break element, ensure the sort-break is at least at the level of the last sort field participating in the Drill Through. For example, in the second report, the Drill Through hyperlink is on the subfooting associated with PRODUCT rather than the heading (with a sort break) associated with CATEGORY.

    Although the code can infer a value of PRODUCT for the CATEGORY heading (you can verify this by embedding the field <PRODUCT> in the heading), it is always the value of the first PRODUCT within that CATEGORY. Typically you want a Drill Through hyperlink for each value of PRODUCT within each CATEGORY.

    You do not need to place the hyperlink on an embedded item. You can just as effectively place it on a text item. Any item in the subfooting is associated with the same values of CATEGORY and PRODUCT. Similarly, you can place a hyperlink on any field in a DATA line, and the values of the associated link fields will be identical. Conventional Drill Down hyperlinks also work this way.

The summary report:

  • Places a hyperlink on the PRODUCT field on each DATA line.
  • Specifies that the fields to link to the next report are CATEGORY and PRODUCT. Since the target fields in the detail report have identical names in the summary report, you can use the notation CATEGORY rather than CATEGORY=CATEGORY.
  • Specifies the action DOWN, so that clicking a hyperlink brings you to the location in the next report that has the corresponding values of the two link fields.
  • Uses the default appearance for the hyperlinks, which is blue, underlined text.

The summary report is:

TABLE FILE GGSALES
SUM UNITS DOLLARS BY CATEGORY BY PRODUCT
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET STYLE *
TYPE=DATA, COLUMN=PRODUCT, DRILLTHROUGH=DOWN(CATEGORY PRODUCT), $
ENDSTYLE
END

The detail report:

  • Places a hyperlink in the subfooting associated with the link field PRODUCT. Since CATEGORY is a higher level BY field than PRODUCT, each PRODUCT subheading is also associated with a unique value of CATEGORY.
  • Places a hyperlink on the first item of the second line of the subfooting, which is the text Return to Summary.
  • Specifies action FIRST, so that clicking the hyperlink jumps to the line in the first (summary) report that contains the same values of the two link fields CATEGORY and PRODUCT.
  • Uses the COLOR attribute to display the hyperlink as red, underlined text.

The detail report is:

SET SQUEEZE=ON
TABLE FILE GGSALES
SUM UNITS BUDUNITS DOLLARS
BY CATEGORY NOPRINT BY PRODUCT NOPRINT
ON CATEGORY PAGE-BREAK
HEADING CENTER
"Category: <CATEGORY"
" "
ON PRODUCT SUBHEAD
"**** Product: <PRODUCT"
ON PRODUCT SUBFOOT
" "
"<25 **** Return to Summary ****"
ON PRODUCT PAGE-BREAK
BY REGION BY CITY
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET STYLE *
TYPE=SUBFOOT, LINE=2, ITEM=1, DRILLTHROUGH=FIRST(CATEGORY PRODUCT),
COLOR=RED, $
ENDSTYLE
END

The next step is the only step that is different for creating a Compound Layout report or a legacy Compound Report.

Example: Creating the Compound Layout Report (Step 4)

Perform this version of Step 4 if you are creating a Compound Layout report.

To create the Compound Layout report:

  • Add a COMPOUND LAYOUT and SECTION declaration to the top of the procedure.
  • Add PAGELAYOUT and COMPONENT declarations for the two reports. Add DRILLMAP attributes to the COMPONENT declarations.
  • Add SET COMPONENT commands and the two reports.
  • End the procedure with a COMPOUND END command:
SET HTMLARCHIVE=ON
COMPOUND LAYOUT PCHOLD FORMAT PDF
UNITS=IN, $
SECTION=section1, LAYOUT=ON, METADATA='0.5^0.5^0.5^0.5', MERGE=OFF,
   ORIENTATION=PORTRAIT, PAGESIZE=Letter,  $
PAGELAYOUT=1, NAME='Page layout 1', text='Page layout 1', TOC-LEVEL=1,
   BOTTOMMARGIN=0.5, TOPMARGIN=0.5, METADATA='BOTTOMMARGIN=0.5,
   TOPMARGIN=0.5,LEFTMARGIN=0,RIGHTMARGIN=0, $
COMPONENT='REPORT1', TEXT='REPORT1', TOC-LEVEL=2,
DRILLMAP=((L1 REPORT2)), POSITION=(0.750 1.083), DIMENSION=(7.000 3.167),
   METADATA='Z-INDEX: 100; LEFT: 0.75in; OVERFLOW: auto; WIDTH: 7in;
   POSITION: absolute; TOP: 1.083in; HEIGHT: 3.167in', $
PAGELAYOUT=2, NAME='Page layout 2', text='Page layout 2', TOC-LEVEL=1,
   BOTTOMMARGIN=0.5, TOPMARGIN=0.5, METADATA='BOTTOMMARGIN=0.5,
   TOPMARGIN=0.5,LEFTMARGIN=0,RIGHTMARGIN=0, $
COMPONENT='REPORT2', TEXT='REPORT2', TOC-LEVEL=2,
DRILLMAP=((L1 REPORT1)), POSITION=(0.500 0.667), DIMENSION=(7.417 7.000),
   METADATA='Z-INDEX: 100; LEFT: 0.5in; OVERFLOW: auto; WIDTH: 7.417in;
   POSITION: absolute; TOP: 0.667in; HEIGHT: 7in', $
END
-* Add Report1 code and SET COMPONENT command
SET COMPONENT='REPORT1'
TABLE FILE GGSALES
SUM UNITS DOLLARS BY CATEGORY BY PRODUCT
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET STYLE *
TYPE=DATA, COLUMN=PRODUCT, DRILLTHROUGH=DOWN(CATEGORY PRODUCT), $
ENDSTYLE
END
-* Add report2 code and SET COMPONENT command
SET COMPONENT='REPORT2'
SET SQUEEZE=ON
TABLE FILE GGSALES
SUM UNITS BUDUNITS DOLLARS
BY CATEGORY NOPRINT BY PRODUCT NOPRINT
ON CATEGORY PAGE-BREAK
HEADING CENTER
"Category: <CATEGORY"
" "
ON PRODUCT SUBHEAD
"**** Product: <PRODUCT"
ON PRODUCT SUBFOOT
" "
"<25 **** Return to Summary ****"
ON PRODUCT PAGE-BREAK
BY REGION BY CITY
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET STYLE *
TYPE=SUBFOOT, LINE=2, ITEM=1, DRILLTHROUGH=FIRST(CATEGORY PRODUCT),
COLOR=RED, $
ENDSTYLE
END
COMPOUND END

Example: Merging Summary and Detail Reports Into a PDF Compound Report (Step 4)

Perform this version of Step 4 if you are creating a legacy compound report.

The next step is to combine the reports into a single PDF Compound Report. You can:

  • Code the OPEN and CLOSE options on the [PC]HOLD FORMAT PDF command.
  • Code the OPEN and CLOSE options on the SET COMPOUND command before the component report syntax.

Drill Through does not support the NOBREAK option, which displays compound reports without intervening page breaks.

This example uses the OPEN and CLOSE options on the PCHOLD FORMAT PDF command:

TABLE FILE GGSALES
SUM UNITS DOLLARS BY CATEGORY BY PRODUCT
ON TABLE PCHOLD FORMAT PDF OPEN
ON TABLE SET STYLE *
TYPE=DATA, COLUMN=PRODUCT, DRILLTHROUGH=DOWN(CATEGORY PRODUCT), $
ENDSTYLE
END
SET SQUEEZE=ON
TABLE FILE GGSALES
SUM UNITS BUDUNITS DOLLARS
BY CATEGORY NOPRINT BY PRODUCT NOPRINT
ON CATEGORY PAGE-BREAK
HEADING CENTER
"Category: <CATEGORY"
" "
ON PRODUCT SUBHEAD
"**** Product: <PRODUCT"
ON PRODUCT SUBFOOT
" "
"<25 **** Return to Summary ****"
ON PRODUCT PAGE-BREAK
BY REGION BY CITY
ON TABLE PCHOLD FORMAT PDF CLOSE
ON TABLE SET STYLE *
TYPE=SUBFOOT, LINE=2, ITEM=1, DRILLTHROUGH=FIRST(CATEGORY PRODUCT),
COLOR=RED, $
ENDSTYLE
END

Example: Run the Drill Through Report (Step 5)

Run the compound report. The first page of output has the summary report with the hyperlinks to the individual products in blue and underlined:

Click the hyperlink Croissant for the category Food. You jump to that detail information. In the detail report, the hyperlink back to the summary report is in red and underlined:

Click the hyperlink Return to Summary to return to the first page (summary report).

Reference: Guidelines on Links For FIRST

The following guidelines apply:

  • The set of link fields used with FIRST must correspond to the set of link fields used with DOWN on the first report.
  • The action of a FIRST hyperlink in the last report should return to the corresponding line in the first report. The chosen set of links must uniquely identify that line of the first report.
  • The DOWN hyperlink on the line of the first report must uniquely identify that line of the first report to locate the matching line of the detail report. The set of links for the DOWN in the first report and the FIRST link in the last report are the same, since they both must uniquely identify a line in the first report.

Reference: Rules For Drill Through Hyperlinks

Reports linked with Drill Through must follow certain rules to ensure that the hyperlinks between them work correctly. The following are key concepts:

  • Source report. The report from which you are linking. The source report contains hyperlinks to the target report.
  • Target report. The report to which you are linking.
  • Link field. One of a set of corresponding fields of the same data type that exist in both the source and target reports. Link fields locate the position in the target report to which a hyperlink in the source report jumps.

Source and target terminology refer to each pair of linked reports. For example, if there are three reports linked with Drill Through, the second report is generally the target report of the first report, and also the source report of the third report.

To process a report as a Drill Through, you must identify the link fields in the source report that relate to the target report:

  • Choose meaningful link fields whose values match in the source and target reports. For example, if a field in the source report contains a part number and a field in the target report contains a Social Security number, the field values will not match and you cannot construct hyperlinks.
  • Specify as many link fields as necessary to uniquely locate the position in the target report that corresponds to the link fields in the source report. For example, if the source report is sorted by STATE and CITY, specifying CITY alone as the link field will be problematic if different states contain a city with the same name.
  • The link fields in the source and target reports must have the same internal (actual) format: the stopped data type and internal length must be identical. Formatting options, such as number of displayed digits and comma suppression, may differ. For example, an A20 field must link to another A20 field. However, an I6C field may link to an I8 field, since internally both are four-byte fields.
  • The link fields must be sort fields or verb objects in both the source and target reports. You can include a NOPRINT (non-display) field, which is useful when constructing a report in which a field is in embedded in heading text.
  • Designing Drill Through reports is very similar to designing Drill Down reports. Choosing the link fields for a Drill Through report is similar to choosing the parameter fields in a Drill Down report. Likewise, the syntax of a Drill Through closely parallels the syntax of a Drill Down.
  • Since Drill Through reports are linked by corresponding values of link fields, the hyperlinks must appear on report elements associated with a particular value of a link field. However, hyperlinks do not have to appear on any link itself.
  • Not all line types are appropriate for placement of a Drill Through hyperlink. For example, if a page break occurs on a BY field that is also a Drill Through link, each page heading is clearly associated with a value in that field. However, if a page break occurs because of page overflow, avoid placing a Drill Through link in a heading. Similarly, subheadings, subfootings, subtotals, and recaps are associated only with the values of particular BY fields.