The Field Name: FIELDNAME

In this section:

How to:

Reference:

Identify a field using FIELDNAME, the first attribute specified in a field declaration in the Master File. You can assign any name to a field, regardless of its name in its native data source. Likewise, for FOCUS data sources, you can assign any name to a field in a new data source.

When you generate a report, each column title in the report has the name of the field displayed in that column as its default, so assigning meaningful field names helps readers of the report. Alternatively, you can specify a different column title within a given report by using the AS phrase in the report request, as described in the Creating Reports With WebFOCUS Language manual, or a different default column title for all reports by using the TITLE attribute in the Master File, as described in Alternative Report Column Titles: TITLE.


Top of page

x
Syntax: How to Identify the Field Name
FIELD[NAME] = field_name

where:

field_name

Is the name you are giving this field. It can be a maximum of 512 characters. Some restrictions apply to names longer than 12 characters, as described in Restrictions for Field Names. The name can include any combination of letters, digits, and underscores (_), and must contain at least one letter. Other characters are not recommended, and may cause problems in some operating environments or when resolving expressions.

It is recommended that you not use field names of the type Cn, En, and Xn (where n is any sequence of one or two digits) because these can be used to refer to report columns, HOLD file fields, and other special objects.

If you must use special characters because of a field report column title, consider using the TITLE attribute in the Master File to specify the title, as described in Alternative Report Column Titles: TITLE.


Top of page

x
Reference: Usage Notes for FIELDNAME

Note the following rules when using FIELDNAME:


Top of page

x
Reference: Restrictions for Field Names

The following restrictions apply to field names and aliases longer than 12 characters:


Top of page

x
Using a Qualified Field Name

How to:

Requests can qualify all referenced field names and aliases with file and/or segment names, a useful technique when duplicate field names exist across segments in a Master File or in joined data sources.

The names of text fields and indexed fields in FOCUS Master Files are limited to 12 characters. Text fields and indexed fields in XFOCUS Master Files are not subject to this 12-character limitation. However, the aliases for text and indexed fields may be up to 512 characters. Field names up to 512 characters appear as column titles in TABLE reports if there is no TITLE attribute or AS phrase.

The default value for the SET FIELDNAME command, SET FIELDNAME=NEW, activates long and qualified field names. The syntax is described in the Developing Reporting Applications manual.



x
Syntax: How to Specify a Qualified Field Name in a Request
[filename.][segname.]fieldname

where:

filename

Is the name of the Master File or tag name. Tag names are used with the JOIN and COMBINE commands.

segname

Is the name of the segment in which the field resides.

fieldname

Is the name of the field.



Example: Qualifying a Field Name

The fully qualified name of the field EMP_ID in the EMPINFO segment of the EMPLOYEE data source is:

EMPLOYEE.EMPINFO.EMP_ID


x
Syntax: How to Change the Qualifying Character
SET QUALCHAR = qualcharacter

The period (.) is the default qualifying character. For further information about the SET QUALCHAR command and valid qualifying characters (. : ! % | \ ), see the Developing Reporting Applications manual.


Top of page

x
Using a Duplicate Field Name

Field names are considered duplicates when you can reference two or more fields with the same field name or alias. Duplication may occur:

Duplicate fields (those having the same field name and alias) are not allowed in the same segment. The second occurrence is never accessed, and the following message is generated when you issue CHECK and CREATE FILE:

(FOC1829) WARNING. FIELDNAME IS NOT UNIQUE WITHIN A SEGMENT: fieldname

Duplicate field names may exist across segments in a Master File. To retrieve such a field, you must qualify its name with the segment name in a request. If a field that appears multiple times in a Master File is not qualified in a request, the first field encountered in the Master File is the one retrieved.

Note: If a Master File includes duplicate field names for real fields and/or virtual fields, the following logic is used when retrieving a field:

Reports can include qualified names as column titles. The SET QUALTITLES command, discussed in the Developing Reporting Applications manual, determines whether reports display qualified column titles for duplicate field names. With SET QUALTITLES=ON, they display qualified column titles for duplicate field names even when the request itself does not specify qualified names. The default value, OFF, disables qualified column titles.


Top of page

x
Rules for Evaluating a Qualified Field Name

The following rules are used to evaluate qualified field names:


WebFOCUS