Linking With Conditions

How to:

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

For complete details on WHEN, see Controlling Report Formatting.

Note: Linking with conditions is not supported in GRAPH requests.

Syntax: How to Link With Conditions

To specify a conditional link to a report use:

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

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. For information on identifying report components, see Identifying a Report Component in a WebFOCUS StyleSheet.
fex
Identifies the file name of the linked procedure to run when you select the report component. For details about linking to another procedure, see Linking to Another Report.
url
Identifies any valid URL, or the name of a report column enclosed in parentheses whose value is a valid URL. For details about linking to a URL, see Linking to a URL.
function
Identifies the JavaScript function to run when you select the report component. For details about calling a JavaScript function, see Linking to a JavaScript Function.
parameters
Values that are passed to the report, URL, or JavaScript function. For details, see Creating Parameters.
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 webpage in which the output from the drill-down link is displayed. For details, see Specifying a Target Frame.

Example: Linking With Conditions

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

Main report:

TABLE FILE EMPLOYEE
SUM CURR_SAL AS 'Total,Current,Salaries'
BY DEPARTMENT AS 'Department'
ON TABLE SET PAGE-NUM OFF
ON TABLE SET STYLE *
TYPE=REPORT, GRID=OFF, $ 
TYPE=DATA, COLUMN=N1, FOCEXEC=REPORT3(DEPARTMENT=N1),
     WHEN=DEPARTMENT EQ 'MIS', $ 
ENDSTYLE
END

Drill-down report (REPORT3):

TABLE FILE EMPLOYEE
PRINT SALARY
BY DEPARTMENT
BY LAST_NAME 
WHERE DEPARTMENT EQ '&DEPARTMENT' 
ON TABLE SET PAGE-NUM OFF
ON TABLE SET STYLE *
TYPE=REPORT, GRID=OFF, $
ENDSTYLE
END

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

When you click MIS, the following output displays:

DEPARTMENT
LAST NAME
SALARY
MIS
  BLACKWOOD
$21,780.00
  CROSS
$27,062.00
$25,755.00
  GREENSPAN
 $9,000.00
 $8,650.00
  JONES
$18,480.00
$17,750.00
  MCCOY
$18,480.00
  SMITH
$13,200.00