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 TIBCO 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.
FIELD[NAME] = field_name
where:
Is the name you are giving this field. It can be a maximum of 512 characters, in a single-byte character set. If you are working in a Unicode environment, this length will be affected by the number of bytes used to represent each character, as described in the chapter named Unicode Support in the TIBCO WebFOCUS® Reporting Server Administration manual. 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.
Note the following rules when using FIELDNAME:
The following restrictions apply to field names and aliases longer than 12 characters:
These display up to 31 characters of the name, and display a caret (>) in the 32nd character to indicate a longer 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.
[filename.][segname.]fieldname
where:
Is the name of the Master File or tag name. Tag names are used with the JOIN and COMBINE commands.
Is the name of the segment in which the field resides.
Is the name of the field.
The fully qualified name of the field EMP_ID in the EMPINFO segment of the EMPLOYEE data source is:
EMPLOYEE.EMPINFO.EMP_ID
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.
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.
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.
The following rules are used to evaluate qualified field names:
TABLE FILE EMPLOYEE PRINT EMPLOYEE.EMPINFO.EMP_ID END
includes EMP_ID as a fully qualified field. The file name, EMPLOYEE, and the segment name, EMPINFO, are the field qualifiers.
Qualifier names can also be duplicated. For example:
FILENAME=CAR, SUFFIX=FOC SEGNAME=ORIGIN, SEGTYPE=S1 FIELDNAME=COUNTRY, COUNTRY, A10, $ SEGNAME=COMP, SEGTYPE=S1, PARENT=ORIGIN FIELDNAME=CAR, CARS, A16, $ . . . TABLE FILE CAR PRINT CAR.COMP.CAR END
This request prints the field with alias CARS. Both the file name and field name are CAR.
A field name can be qualified with a single qualifier, either its file name or its segment name. For example:
FILENAME=CAR, SUFFIX=FOC SEGNAME=ORIGIN, SEGTYPE=S1 FIELDNAME=COUNTRY, COUNTRY, A10, $ SEGNAME=COMP, SEGTYPE=S1, PARENT=ORIGIN FIELDNAME=CAR, CARS, A16, $ . . . TABLE FILE CAR PRINT COMP.CAR AND CAR.CAR END
This request prints the field with alias CARS twice.
When there is a single qualifier, segment name takes precedence over file name. Therefore, if the file name and segment name are the same, the field qualified by the segment name is retrieved.
FILENAME=CAR, SUFFIX=FOC SEGNAME=ORIGIN, SEGTYPE=S1 FIELDNAME=CNT.COUNTRY, ACNTRY, A10, $ FIELDNAME=COUNTRY, BCNTRY, A10, $ TABLE FILE CAR SUM CNT.COUNTRY END
In this request, the string CNT.COUNTRY is interpreted as a reference to the field named CNT.COUNTRY, not as a reference to the prefix operator CNT. applied to the field named COUNTRY. Therefore, the request sums the field whose alias is ACNTRY. Although the field name CNT.COUNTRY contains a period as one of its characters, it is an unqualified field name. It is not a qualified name or a prefix operator acting on a field name, neither of which is allowed in a Master File. The request does not count instances of the field whose alias is BCNTRY.
For example:
FILENAME=CAR, SUFFIX=FOC SEGNAME=ORIGIN, SEGTYPE=S1 FIELDNAME=COUNTRY, COUNTRY, A10, $ SEGNAME=PCT, SEGTYPE=S1, PARENT=ORIGIN FIELDNAME=CAR, CARS, I2, $ TABLE FILE CAR SUM PCT.CAR PCT.PCT.CAR BY COUNTRY END
This request sums the field with alias CARS first, and then the percent of CARS by COUNTRY.
In the following example, the choice is between an unqualified field name (the field named ORIGIN.COUNTRY in the ORIGIN segment) and a field name with segment name qualification (the field named COUNTRY in the ORIGIN segment). The field with segment name qualification is retrieved:
FILENAME=CAR, SUFFIX=FOC SEGNAME=ORIGIN, SEGTYPE=S1 FIELDNAME=ORIGIN.COUNTRY, OCNTRY, A10, $ FIELDNAME=COUNTRY, CNTRY, A10, $ TABLE FILE CAR PRINT ORIGIN.COUNTRY END
This request prints the field with alias CNTRY. To retrieve the field with alias OCNTRY, qualify its field name, ORIGIN.COUNTRY, with its segment name, ORIGIN:
PRINT ORIGIN.ORIGIN.COUNTRY
FILENAME=CAR, SUFFIX=FOC SEGNAME=CAR, SEGTYPE=S1 FIELDNAME=CAR.CAR, CAR1, A10, $ SEGNAME=CAR.CAR, SEGTYPE=S1, PARENT=CAR FIELDNAME=CAR, CAR2, A10, $ TABLE FILE CAR PRINT CAR.CAR.CAR END
In this example, it is unclear if you intend CAR.CAR.CAR to refer to the field named CAR.CAR in the CAR segment, or the field named CAR in the CAR.CAR segment. (In either case, the name CAR.CAR is an unqualified name that contains a period, not a qualified name. Qualified names are not permitted in Master Files.)
No matter what the intention, the qualified field name is exactly the same and there is no obvious choice between levels of qualification.
Since the field with alias CAR2 has the shortest basic field name length, CAR2 is printed. This is different from the prior example, where the choice is between two levels of qualification. To retrieve the CAR1 field, you must specify its alias.