Parameterizing a Synonym with Variables

How to:

Reference:

You can define variables in a synonym in order to specify synonym attributes, such as the connection name or the table name. The variable is saved in the synonym as an object and is available for use in all subsequent reports derived from the synonym.

Procedure: How to Add a Variable to a Synonym

  1. Right-click an object in the Metadata canvas, point to Insert, and then click Variable.
  2. A new folder named Variables is added to the object tree, with &&VARIABLE1 as an entry. The Properties panel shows the attributes of the variable.
  3. If desired, change the name of the variable and enter a default value in the appropriate fields.

Reference: Variables Attribute Summary

Variables in a synonym can have the following attributes:

VARIABLE

The name of the variable. A double ampersand (&&) is automatically inserted in the name to indicate a global variable.

DEFAULT

The default value for the variable. If no value is set, the default value is used.

QUOTED

When selected, single quotation marks are added around the assigned string for the variable. A single quotation mark within the string is converted into two single quotation marks.

FORMAT

Optional description of the prompt value format for the variable. The format type can be Alpha fixed, Integer, or Decimal Packed.

PROMPT

The text that appears when prompting for a value for the variable.

ACCEPT

Allows you to select the method used to specify values that can be accepted for this variable. The following options are available:

  • OR
  • DECODE
  • FIND (applies to Maintain only)
  • SYNONYM
  • FOCEXEC
  • FROM-TO
Select Type

Allows you to specify whether you can select from a single or multiple list of values.

Values

Lists the values that are acceptable.

Procedure: How to Use a Variable in a Synonym

Variables in a synonym are commonly used to represent a table name or connection name.

  1. In a synonym for a relational database where variables have been established, click a segment to open the Properties panel that shows the Adapter Specific attributes.
  2. In the fields for TABLENAME and CONNECTION, enter the names of the variables to be used.
  3. Click Save to save your changes.

WebFOCUS

Feedback