User Tools

Site Tools


project_set_view_fields_.htm
Navigation:  Language Reference > 4 - Entity Declarations > View Structures >====== PROJECT (set view fields) ====== Previous pageReturn to chapter overviewNext page

PROJECT( fields )

blk2blue.jpg

PROJECT Declares the fields retrieved for the VIEW.
fields A comma delimited list of fields (including prefixes) from the primary file of the VIEW, or the secondary related file named in the JOIN structure, containing the PROJECT declaration.

The PROJECT statement declares fields retrieved for a relational “Project” operation. A relational “Project” operation retrieves only the specified fields from the file, not the entire record structure.

A PROJECT statement may be declared in the VIEW, or within one of its component JOIN structures. If there is no PROJECT declaration in the VIEW or JOIN structure, all fields in the relevant file are retrieved.

If a PROJECT statement is present in the VIEW or JOIN structure, only the fields explicitly declared in the PROJECT are guaranteed to be retrieved. The contents of any fields that are not contained in PROJECT statements are undefined. Depending on the abilites of the particular database engine you are using, other fields may be retrieved. However, you should not rely on this as future changes or changes in the database driver may preclude these fields from being retrieved.

Example:

Detail   FILE,DRIVER('Clarion'),PRE(Dtl) !Declare detail file layout

OrderKey   KEY(Dtl:OrderNumber)

Record      RECORD

OrderNumber  LONG

Item         LONG

Quantity     SHORT

Description  STRING(20)  !Line item comment

           END

        END

Product  FILE,DRIVER('Clarion'),PRE(Pro) !Declare product file layout

ItemKey   KEY(Pro:Item)

Record    RECORD

Item        LONG

Description STRING(20)  !Product description

Price       DECIMAL(9,2)

         END

       END

ViewOrder VIEW(Detail)

    PROJECT(Det:OrderNumber,Det:Item,Det:Description)

     JOIN(Pro:ItemKey,Det:Item)

      PROJECT(Pro:Description,Pro:Price)

     END

    END

project_set_view_fields_.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1