Linking in a Report

In this section:

You can use StyleSheet declarations to define links from any report component. You can create links from report data (including headings and footings) as well as graphic images (such as a company logo or product image).

Linking to a URL

How to:

You can define a link from any report component to any URL. Once you have defined a link, you can select the report component to access the URL.

Syntax: How to Link to a URL

TYPE=type, [subtype], URL=url[(parameters ...)], [TARGET=frame,]$

where:

type

Identifies the report component that you select in the Web browser to execute the link. The TYPE attribute and its value must appear at the beginning of the declaration.

subtype

Are any additional attributes, such as COLUMN, LINE, or ITEM, that are needed to identify the report component that you are formatting.

url

Identifies any valid URL, including a URL that specifies a CGI program, or the name of a report column enclosed in parentheses whose value is a valid URL to which the link will jump.

Note:

  • The maximum length of a URL=url argument, including any associated variable=object parameters, is 2400 characters. The URL argument can span more than one line.
  • If the URL refers to a CGI program that takes parameters, the URL must end with a question mark (?).
parameters

Values that are passed to the URL.

frame

Identifies the target frame in the Web page in which the output from the link is displayed. For details, see Specifying a Target Frame.

Example: Linking to a URL

The following example illustrates how to link to a URL from a report. The heading Click here to access the IB homepage is linked to the URL http://www.ibi.com. The relevant StyleSheet declarations are highlighted in the request.

TABLE FILE GGSALES
ON TABLE SET PAGE-NUM OFF
SUM UNITS AND DOLLARS
BY CATEGORY BY REGION
HEADING
"Regional Sales Report"
"Click here to access the IB homepage."
" "
ON TABLE SET STYLE *
TYPE=REPORT, GRID=OFF, $ 
TYPE=HEADING, LINE=2, OBJECT=TEXT, ITEM=1,
   URL=http://www.ibi.com, $ 
ENDSTYLE
END

The output is:

When you click the link, the site appears in your browser.

Linking to a JavaScript Function

How to:

You can use a StyleSheet to define a link to a JavaScript function from any report component. Once you have defined the link, you can select the report component to execute the JavaScript function.

You can specify optional parameters that allow values to be passed to the JavaScript function. The function will use the passed value to dynamically determine the results that are returned to the browser.

Note:

Syntax: How to Link to a JavaScript Function

TYPE=type, [subtype], JAVASCRIPT=function[(parameters ...)], $

where:

type

Identifies the report component that you select in the Web browser to execute the link. The TYPE attribute and its value must appear at the beginning of the declaration.

subtype

Are any additional attributes, such as COLUMN, LINE, or ITEM, that are needed to identify the report component that you are formatting.

function

Identifies the JavaScript function to run when you select the report component.

The maximum length of a JAVASCRIPT=function argument, including any associated parameters, is 2400 characters and can span more than one line. If you split a single argument across a line, you must use the \ character at the end of the first line, as continuation syntax. If you split an argument at a point where a space is required as a delimiter, the space must be before the \ character or be the first character on the next line. The \ character does not act as the delimiter.

parameters

Values that are passed to the JavaScript function.

Linking With Conditions

How to:

You can create conditions when linking from a report. For example, you may be interested in displaying only current salaries for a particular department. You can accomplish this by creating a WHEN condition.

Syntax: How to Link With Conditions

To specify a conditional link to a URL use:

TYPE=type, [subtype], URL=url[(parameters...)],
   WHEN=expression,[TARGET=frame,] $

To specify a conditional link to a JavaScript function use

TYPE=type, [subtype], JAVASCRIPT=function[(parameters...)],
   WHEN=expression,[TARGET=frame,] $

where:

type

Identifies the report component that you select in the Web browser to execute the link. The TYPE attribute and its value must appear at the beginning of the declaration.

subtype

Are any additional attributes, such as COLUMN, LINE, or ITEM, that are needed to identify the report component that you are formatting.

url

Identifies any valid URL, or the name of a report column enclosed in parentheses whose value is a valid URL.

function

Identifies the JavaScript function to run when you select the report component.

parameters

Values that are passed to the URL.

expression

Is any Boolean expression that would be valid on the right side of a COMPUTE expression.

Note: IF... THEN... ELSE logic is not necessary in a WHEN clause and is not supported. All non-numeric literals in a WHEN expression must be specified within single quotation marks.

frame

Identifies the target frame in the Web page in which the output from the link is displayed. For details, see Specifying a Target Frame.

Example: Linking With Conditions

Assume you want to link only the MIS value of the DEPARTMENT field to the URL. To do this we include the phrase WHEN=DEPARTMENT EQ 'MIS' in the StyleSheet declaration. The relevant declarations are highlighted in the requests.

TABLE FILE EMPLOYEE
SUM CURR_SAL AS 'Total,Current,Salaries'
BY DEPARTMENT AS 'Department'
ON TABLE SET PAGE-NUM OFF
ON TABLE HOLD FORMAT HTML
ON TABLE SET STYLE *
TYPE=REPORT, GRID=OFF, $ 
TYPE=DATA, COLUMN=N1, URL=http://www.informationbuilders.com,
     WHEN=DEPARTMENT EQ 'MIS', $ 
ENDSTYLE
END

In the following output, note that only the MIS department is linked:

Linking From a Graphic Image

How to:

You can link from an image in an HTML report. The image can be attached to the entire report or to the report heading or footing (this includes table headings/table footings, and sub-headings/sub-footings).

The syntax for linking from a graphic image is the same as when linking from a report component. The only difference is that you add IMAGE=image to the StyleSheet declaration.

Note: You can only link from an image when you are using HTML format.

Syntax: How to Specify Links From a Graphic Image

TYPE=type, [subtype], IMAGE=image, URL=url 
   [(parameters ...)],[TARGET=frame,] $

where:

type

Identifies the report component that the user selects to execute the link. The TYPE attribute and its value must appear at the beginning of the declaration. You can specify the following types of components:

TABHEADING or TABFOOTING enables you to link from a graphical image that is attached to a report heading or footing.

HEADING or FOOTING enables you to link from a graphical image that is attached to a page heading or footing.

SUBHEAD or SUBFOOT enables you to link from a graphical image that is attached to a sub heading or sub footing.

subtype

Are any additional attributes, such as COLUMN, LINE, or ITEM, that are needed to identify the report component that you are formatting.

image

Specifies the file name of a graphical image file. The image must exist as a separate graphic file in a format that your browser supports. Most browsers support GIF and JPEG file types.

You can specify a local image file, or identify an image elsewhere on the network using a URL. URLs can be absolute, such as http://www.ibi.com/graphic.gif, or relative aliases that can be identified to the Web server, such as /approot/ibinccen/graphic.gif.

Alternatively, you can specify an alphanumeric field in the report (either a BY sort field or a display field) whose value corresponds to the name of the image file.

url

Identifies any valid URL, or the name of a report column enclosed in parentheses whose value is a valid URL.

parameters

Are values that are passed to the URL. You can pass one or more parameters. The entire string of parameters must be enclosed in parentheses, and separated from each other by a blank space.

frame

Identifies the target frame in the Web page in which the output from the link is displayed. For details, see Specifying a Target Frame.

Example: Specifying a Link From an Image

The following example illustrates how to link a URL from an image. The relevant StyleSheet declarations are highlighted in the request.

TABLE FILE EMPLOYEE
PRINT LAST_NAME BY EMP_ID
HEADING
"List Of Employees By Employee ID"
ON TABLE SET PAGE-NUM OFF
ON TABLE HOLD FORMAT HTML
ON TABLE SET STYLE *
TYPE=HEADING, STYLE=BOLD, $
TYPE=REPORT, GRID=OFF, $ 
TYPE=REPORT, IMAGE=C:\IMAGES\LEFTLOGO.GIF,
     URL=HTTP://INFORMATIONBUILDERS.COM, $ 
ENDSTYLE
END

The output is:

When you click the graphic, the Information Builders Web site opens.

Specifying a Base URL

How to:

If you want to create a link but do not know the full, physical URLs, you can specify a default location where the browser searches for relative URLs.

To specify a default URL location, use the SET BASEURL command. Using SET BASEURL puts <BASE HREF="url"> into the HTML file that FOCUS generates. When a report is run, the specified directory is searched for the files that are called by the generated Web page.

Syntax: How to Specify a Base URL

SET BASEURL=url

where:

url

Is the fully-qualified directory in which additional files reside. If it points to a Web server, the URL must begin with http://. The URL MUST end with a closing delimiter (/ or \).

Example: Specifying a Base URL

The following illustrates how to specify a base URL:

SET BASEURL=http://www.informationbuilders.com/ibi_html/newcentcorp/
   images/

If you are including a graphic image in your report that is stored in the specified base URL, you can add the following declaration to your StyleSheet instead of typing the entire URL:

TYPE=HEADING, IMAGE=leftlogo.gif, ..., $

Note: If the URL is at a remote website, it may take longer to retrieve. Whenever possible, store graphic image files on your system.

Specifying a Target Frame

How to:

You can use frames to subdivide application HTML pages into separate scrollable sections. Frames enable users to explore various information items on a page by scrolling through a section, instead of linking to a separate page. When defining a link from a report component, you can specify that the results of the link be displayed in a target frame on a Web page.

There are two ways to specify a target frame. You can specify:

To use the TARGET attribute or the SET TARGETFRAME command, you must create multiple frames on the Web page.

Syntax: How to Specify a Target Frame

To specify a target frame for a URL, use

TYPE=type, [subtype], URL=url[(parameters ...)], [TARGET=frame,] $

where:

type

Identifies the report component that the user selects in the Web browser to execute the link. The TYPE attribute and its value must appear at the beginning of the declaration.

subtype

Are any additional attributes, such as COLUMN, LINE, or ITEM, that are needed to identify the report component that you are formatting.

url

Identifies any valid URL, or the name of a report column enclosed in parentheses whose value is a valid URL to which the link will jump. For details about linking to an URL, see Linking to a URL.

parameters

Are values being passed to the URL. You can pass one or more parameters. The entire string of values must be enclosed in parentheses, and separated from each other by a blank space.

frame

Identifies the target frame in the Web page in which the output from the link is displayed.

If the name of the target frame contains embedded spaces, the name will be correctly interpreted without enclosing the name in quotation marks. For example:

TYPE=DATA, COLUMN=N1,
FOCEXEC=MYREPORT, TARGET=MY FRAME, $

The name of the target frame is correctly interpreted to be MY FRAME.

You can also use the following standard HTML frame names: _BLANK, _SELF, _PARENT, _TOP.

Syntax: How to Specify a Default Target Frame

SET TARGETFRAME=frame

where:

frame

Identifies the target frame in the Web page in which the output from the link is displayed.

Example: Specifying a Target Frame

The following illustrates how to specify a default target frame:

SET TARGETFRAME=_SELF

The following illustrates how to specify a target frame in a request. The relevant StyleSheet declaration is highlighted in the request.

TABLE FILE EMPLOYEE
PRINT CURR_SAL
BY DEPARTMENT
ON TABLE HOLD FORMAT HTML
ON TABLE SET STYLE * 
TYPE=DATA, COLUMN=N1, URL=http:\\www.informationbuilders.com,
     TARGET=_SELF, $ 
ENDSTYLE
END

Linking Report Pages

How to:

With a StyleSheet, you can insert one or more navigational hyperlinks in a multi-page HTML report. This feature makes it easy for you to link consecutive report pages together without creating individual hyperlinks for each page.

You can define any report component as a hyperlink.

Syntax: How to Link Report Pages

Use the following syntax in an HTML report

URL=#_destination, $

where:

destination

Is one of the following:

#_next goes to the top of the next report page.

#_previous goes to the top of the previous report page.

#_top goes to the top of the current report page.

#_start goes to the first page of the report.

#_end goes to the last page of the report.

Example: Linking Report Pages Through Images in a Heading

This request displays two images in the page heading of a long report. It creates a link between BULLET.GIF and the next page of the report, and GOBACK.GIF and the previous page of the report.

TABLE FILE GGORDER
ON TABLE SUBHEAD
"COFFEE GRINDER SALES BY STORE"
" "
HEADING
"Next page or previous page."
PRINT QUANTITY AS 'Ordered Units' BY STORE_CODE BY PRODUCT NOPRINT
BY ORDER_NUMBER
WHERE PRODUCT EQ 'Coffee Grinder'
ON STORE_CODE PAGE-BREAK
ON TABLE HOLD FORMAT HTML
ON TABLE SET STYLE *
TYPE=REPORT, GRID=OFF, $
TYPE=TABHEADING, STYLE=BOLD,$ 
TYPE=HEADING, IMAGE=C:\IMAGES\BULLET, URL=#_next, IMAGEALIGN=LEFT,$
TYPE=HEADING, IMAGE=C:\IMAGES\GOBACK, URL=#_previous, IMAGEALIGN=RIGHT,$ 
ENDSTYLE
END

The images display in each page heading.

Click the image on the left of page 1 to display page 2:

Click the "go back" image on page 2 to redisplay page 1.

Example: Linking Pages Through Page Number and Heading Elements

This request creates hyperlinks from the page number to the next page in the report, and from the text of the page heading, which appears at the top of every report page, back to the previous page or to the first page.

TABLE FILE GGORDER
ON TABLE SUBHEAD
"COFFEE GRINDER SALES BY STORE"
" "
HEADING
"return to previous page"
"return to beginning"
PRINT QUANTITY AS 'Ordered Units' BY STORE_CODE BY PRODUCT NOPRINT
BY ORDER_NUMBER
WHERE PRODUCT EQ 'Coffee Grinder'
ON STORE_CODE PAGE-BREAK
ON TABLE HOLD FORMAT HTML
ON TABLE SET STYLE *
TYPE=REPORT, GRID=OFF, $
TYPE=TABHEADING, STYLE=BOLD,$
TYPE=PAGENUM, URL=#_next, $ 
TYPE=HEADING, LINE=1, URL=#_previous, $
TYPE=HEADING, LINE=2, URL=#_start, $
ENDSTYLE
END

The first page is:

Click the page number three times to move to PAGE 4:

Click previous page to return to PAGE 3. Click return to beginning to go directly to PAGE 1.


Information Builders