User Tools

Site Tools


what_return_field_from_group_.htm

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
what_return_field_from_group_.htm [2021/04/15 15:57] – external edit 127.0.0.1what_return_field_from_group_.htm [2021/07/27 04:49] (current) – Fix &amp to &= carlbarnes
Line 13: Line 13:
 The **WHAT** statement returns the //number// specified field from a //group// structure. Generally, this would be assigned to an ANY variable. If the number specified field is a dimensioned field, then WHAT returns a reference to the //dimension// element of the //number// field. The **WHAT** statement returns the //number// specified field from a //group// structure. Generally, this would be assigned to an ANY variable. If the number specified field is a dimensioned field, then WHAT returns a reference to the //dimension// element of the //number// field.
  
-If the field with an ordinal position equal to the passed second parameter is defined as an ANY type or has the DIM attribute, the returned value can only be used in "reference equality" (&=) operations. Any attempt to access the field will cause a run-time error.+If the field with an ordinal position equal to the passed second parameter is defined as an ANY type or has the DIM attribute, the returned value can only be used in "reference equality" ( &= ) operations. Any attempt to access the field will cause a run-time error.
  
 **Return Data Type:     **ANY **Return Data Type:     **ANY
Line 19: Line 19:
 **Example:** **Example:**
  
-**MyGroup  GROUP** +<code> 
- +MyGroup  GROUP 
-**F1        LONG(3)             !Field number 1** +F1        LONG(3)             !Field number 1 
- +F2        SHORT               !Field number 2 
-**F2        SHORT               !Field number 2** +F3        STRING(30)          !Field number 3 
- +InGroup    GROUP              !Field number 4 
-**F3        STRING(30)          !Field number 3** +F1          LONG              !Field number 5 
- +F2          SHORT(2)          !Field number 6 
-**InGroup    GROUP              !Field number 4** +F3          STRING(30),DIM(2) !Field number 7 
- +F4          LONG,DIM(3,3)     !Field number 8 
-**F1          LONG              !Field number 5** +F5          ANY 
- +          END 
-**F2          SHORT(2)          !Field number 6** +         END 
- +  
-**F3          STRING(30),DIM(2) !Field number 7** +CurrentField ANY 
- +  
-**F4          LONG,DIM(3,3)     !Field number 8** +CODE 
- +CurrentField &= WHAT(MyGroup,1)   !Returns contents of MyGroup.F1 (3) 
-**F5          ANY** +CurrentField &= WHAT(MyGroup,6)   !Returns contents of MyGroup.Ingroup.F2 (2) 
- +CurrentField &= WHAT(MyGroup,7)   !Returns contents of MyGroup.Ingroup.F3[1] 
-**           END** + IF CurrentField &= RefVar        !LEGAL 
- +  CurrentField = 2                !INVALID – posts a runtime error 
-**          END** + END 
- +CurrentField &= WHAT(MyGroup,8,3) !Returns contents of MyGroup.Ingroup.F4[1,3] 
-**CurrentField ANY** +CurrentField &= WHAT(MyGroup,8,5) !Returns contents of MyGroup.Ingroup.F4[2,2] 
- +  
-** CODE** +!For String Comparison, the returned field must be moved into a work field:  
- +CurrentField &= WHAT(MyGroup,8,7) !Returns contents of MyGroup.Ingroup.F4[3,1] 
-** CurrentField &amp;****WHAT****(MyGroup,1)   !Returns contents of MyGroup.F1 (3)** +IF CurrentField = 'xyz' 
- + !do something 
-** CurrentField &amp;****WHAT****(MyGroup,6)   !Returns contents of MyGroup.Ingroup.F2 (2)** +END 
- +</code>
-** CurrentField &amp;****WHAT****(MyGroup,7)   !Returns contents of MyGroup.Ingroup.F3[1]** +
- +
-**  IF CurrentField &amp;= RefVar        !LEGAL** +
- +
-**   CurrentField = 2                !INVALID posts a runtime error** +
- +
-**  END** +
- +
-** CurrentField &amp;****WHAT****(MyGroup,8,3) !Returns contents of MyGroup.Ingroup.F4[1,3]** +
- +
-** CurrentField &amp;****WHAT****(MyGroup,8,5) !Returns contents of MyGroup.Ingroup.F4[2,2]** +
- +
-**!For String Comparison, the returned field must be moved into a work field: ** +
- +
-** CurrentField &amp;****WHAT****(MyGroup,8,7) !Returns contents of MyGroup.Ingroup.F4[3,1]** +
- +
-** IF CurrentField = 'xyz'** +
- +
-**  !do something** +
- +
-** END**+
  
 **See Also:** **See Also:**
what_return_field_from_group_.htm.txt · Last modified: 2021/07/27 04:49 by carlbarnes