Field Qualification

Top  Previous  Next

Variables declared as members of complex data structures (GROUP, QUEUE, FILE, RECORD, etc.) may have duplicate labels, as long as the duplicates are not contained within the same structure. To explicitly reference fields with duplicate labels in separate structures, you may use the PRE attribute on the structures just as it is documented (Prefix:FieldLabel) to provide unique names for each field. However, the PRE attribute is not required for this purpose and may be omitted.

Any member of any complex structure can be explicitly referenced by prepending the label of the structure containing the field to the field label, separated by a period (StructureName.FieldLabel). You must use this Field Qualification syntax to reference any field in a complex structure that does not have a PRE attribute. You may use a colon (:) instead of a period (StructureName:FieldLabel) to reference member variables of any structure except CLASS and named reference variables (this syntax is only to provide backward compatibility with previous versions of Clarion for Windows).

If the variable is within nested complex data structures, you must prepend each successive level's structure label to the variable label to explicitly reference the variable (if the nested structure has a label). If any nested structure does not have a label, then that part is omitted from the qualification sequence. This is similar to anonymous unions in C++. This means that, in the case of a GROUP structure (without a PRE attribute) in which a nested GROUP structure has a label, the fields in the inner GROUP must be referenced as OuterGroupLabel.InnerGroupLabel.FieldLabel. If the inner GROUP structure does not have a label, the individual fields are referenced as OuterGroupLabel.FieldLabel. There is one exception to this rule: the label of a RECORD structure within a FILE may be omitted so that you can reference individual fields within the file as FileLabel.FieldLabel instead of FileLabel.RecordLabel.FieldLabel.

This Field Qualification syntax is also used to reference all members of CLASS structures--both data members and methods. To call a member method of a CLASS structure, you specify ClassName.MethodLabel wherever the call to the PROCEDURE is valid.

To reference an element of a GROUP structure with the DIM attribute, you must specify the array element number in the Field Qualification syntax at the exact level at which the DIM attribute appears.


MasterFile FILE,DRIVER('TopSpeed')

Record      RECORD

AcctNumber   LONG         !Reference as Masterfile.AcctNumber




Detail    FILE,DRIVER('TopSpeed')


AcctNumber  LONG          !Reference as Detail.AcctNumber




Memory    GROUP,PRE(Mem)

Message    STRING(30)     !May reference as Mem:Message or Memory.Message


SaveQueue QUEUE

Field1     LONG           !Reference as SaveQueue.Field1

Field2     STRING         !Reference as SaveQueue.Field2


OuterGroup GROUP

Field1     LONG           !Reference as OuterGroup.Field1

Field2     STRING         !Reference as OuterGroup.Field2

InnerGroup  GROUP

Field1       LONG         !Reference as OuterGroup.InnerGroup.Field1

Field2       STRING       !Reference as OuterGroup.InnerGroup.Field2



OuterGroup GROUP,DIM(5)

Field1     LONG           !Reference as OuterGroup[1].Field1

InnerGroup  GROUP,DIM(5)  !Reference as OuterGroup[1].InnerGroup

Field1       LONG         !Reference as OuterGroup[1].InnerGroup[1].Field1



See Also:



Reference Variables