User Tools

Site Tools


prop_files.htm
Navigation:  Language Reference > App C - PROP: Runtime Properties > Runtime VIEW and FILE Properties >====== PROP:Files ====== Previous pageReturn to chapter overviewNext page

Property of a VIEW which returns the total number of files in the VIEW. This is equivalent to the total number of JOIN structures, plus one (the primary file named in the VIEW statement itself). (READ ONLY)

view{PROP:files, N}

Returns the number of JOINs (including sub-joins) that there are for a file. N is the order of the file nested in the VIEW. If n is 0, the total number of files in the VIEW is returned. This property is useful to detect how many files are children of a target JOIN.

Example 1:

AView  VIEW(BaseFile)                                        !File 1

    JOIN(ParentFile,'BaseFile.parentID = ParentFile.ID')    !File 2

     JOIN(GrandParent.PrimaryKey, ParentFile.GrandParentID) !File 3

     END

    END

    JOIN(OtherParent.PrimaryKey,BaseFile.OtherParentID)     !File 4

    END

   END     ! AView{PROP:Files} returns 4

           ! AView{PROP:File,1} returns a reference to BaseFile

           ! AView{PROP:File,2} returns a reference to Parent

           ! AView{PROP:File,3} returns a reference to GrandParent

           ! AView{PROP:File,4} returns a reference to OtherParent

FilesQ QUEUE

FileRef &FILE

      END

CODE

LOOP X# = 1 TO AView{PROP:Files}       !Loop 4 times

 FilesQ.FileRef &= AView{PROP:File,X#} !Reference assign each file in the VIEW

 ADD(FilesQ)                           ! and add it to the queue

 ASSERT(~ERRORCODE())                  !Assume no errors

 CLEAR(FilesQ)                         !Clear the queue for the next assignment

END

Example 2:

v VIEW(PFile),ORDER('PFile:String1'),FILTER('PFile:ID = 3')

  PROJECT(PFile:ID, PFile:String1)

   JOIN(Child1:Keyname, PFile:ID)         !File Child1 has 4 fields

    JOIN(Child2:Keyname, Child1:ID)       !File Child2 has 4 fields

     JOIN(Child3, 'Child3:LinkField = Child2:ID')

      PROJECT(Child3:String2)

     END

    END

    JOIN(Child2Child1:KeyName, Child1:ID) !File Child2Child1 has 4 fields

   END

  END

 END

v{PROP:Files, 0} will return 5

v{PROP:Files, 1} will return 4

v{PROP:Files, 2} will return 3

v{PROP:Files, 3} will return 1

v{PROP:Files, 4} will return 0

v{PROP:Files, 5} will return 0

See Also: JOIN

prop_files.htm.txt · Last modified: 2021/04/15 15:57 (external edit)