Megosztás a következőn keresztül:


SET FIELDS Command

Specifies which fields in a table can be accessed.

SET FIELDS ON | OFF | LOCAL | GLOBAL

-Or-

SET FIELDS TO [[FieldName1 [, FieldName2 ...]]
    | ALL [LIKE Skeleton | EXCEPT Skeleton]]

Parameters

  • ON
    Specifies that only the fields in the field list can be accessed.

  • OFF
    (Default) Specifies that all the fields in the current table can be accessed.

  • LOCAL
    Specifies that only the fields in the current work area listed in the fields list can be accessed.

  • GLOBAL
    Specifies that all fields in the field list, including fields in other work areas, can be accessed.

    SET FIELDS GLOBAL lets you access fields in other work areas without issuing SET COMPATIBLE TO DB4.

  • TO [FieldName1 [, FieldName2 ...]]
    Specifies the names of fields that can be accessed in the current table. You must include an alias with the field name in the following cases:

    • When the field is in a table that is open in a work area other than the currently selected work area.
    • When the field names are the same in two or more tables.

    You can include fields from tables that are open in other work areas if the fields are prefaced with their table aliases. However, these fields cannot be accessed unless you issue SET FIELDS GLOBAL or SET COMPATIBLE DB4.

    The field list can contain statements for creating calculated fields. A calculated field contains read-only data created with an expression. This expression can take any form, but it must be a valid FoxPro expression. Calculated fields cannot be accessed unless you issue SET FIELDS GLOBAL or SET COMPATIBLE DB4.

    The format of the statement you use to create a calculated field is:

    <calculated field name> = <expr>
    

    This example creates a calculated field called LOCATION:

    CLOSE DATABASES
    USE customer
    SET FIELDS TO LOCATION = ALLTRIM(city) + ', ' + state
    

    CITY and STATE are the names of fields from the selected table.

  • ALL
    Allows access to all the fields in the current table.

  • ALL LIKE Skeleton | EXCEPT Skeleton
    You can selectively access fields by including the LIKE or EXCEPT clause or both. If you include LIKE Skeleton, you can access fields that match Skeleton. If you include EXCEPT Skeleton, you can access all fields except those that match Skeleton.

    The skeleton Skeleton supports wildcards such as * and ?. For example, to access fields that begin with the letters A and P, issue the following:

    SET FIELDS TO ALL LIKE A*,P*
    

    The LIKE clause can be combined with the EXCEPT clause:

    SET FIELDS TO ALL LIKE A*,P* EXCEPT PARTNO*
    

Remarks

SET FIELDS TO is additive — issuing SET FIELDS TO with a field list adds the specified fields to those that are currently accessible.

Issuing SET FIELDS TO implicitly performs SET FIELDS ON. Issuing SET FIELDS TO without any additional arguments implicitly performs SET FIELDS OFF. Issue SET FIELDS TO without including either a field list or ALL to remove all fields from the field list for the current table.

SET FIELDS is scoped to the current data session.

See Also

SET FILTER | SET DATASESSION | SET COMPATIBLE Command