DEFINE FIELDGROUP command: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (add link)
 
(12 intermediate revisions by 3 users not shown)
Line 4: Line 4:
<b>Privileges</b>
<b>Privileges</b>
<p>Any user</p>
<p>Any user</p>
<b>Function</b><p>To establish the contents of a field group, including the fields and field groups associated with the field group being defined.</p>
<b>Function</b><p>To establish the contents of a [[Field_group_design|field group]], including the fields and field groups associated with the field group being defined.</p>


<b>Syntax</b>
==Syntax==
<p class="syntax">DEFINE FIELDGROUP <span class="term">FieldGroupName</span>
<p class="syntax">DEFINE FIELDGROUP <span class="term">FieldGroupName</span>
   [WITH FIELDGROUP <span class="term">OuterGroupName</span>]</p>
   [WITH FIELDGROUP <span class="term">OuterGroupName</span>]</p>
<p>Where:</p>
<p>
Where:</p>
<ul>
<ul>
<li><var class="term">FieldGroupName</var> specifies the name of the field group you are defining.</li>
<li><var class="term">FieldGroupName</var> specifies the name of the field group you are defining.  
<p>
A field group name must be unique among field group names, and it cannot have the same name as any field.</p></li>
 
<li><var class="term">OuterGroupName</var> specifies the name of another field group previously defined. The field group being defined is nested under the <var class="term">OuterGroupName</var>.</li>
<li><var class="term">OuterGroupName</var> specifies the name of another field group previously defined. The field group being defined is nested under the <var class="term">OuterGroupName</var>.</li>
</ul>
</ul>


<b>Example</b>
<p>For general syntax and usage notes that apply to all forms of the <var>DEFINE</var> command, see <var>[[DEFINE command]]</var>.</p>
<p>To define a field group MAKE_MODEL with fields MAKE and MODEL in it, you would write the following definition.</p>
 
==Adding fieldgroup contents==
The <var>WITH FIELDGROUP</var> clause identifies a field group that is already defined.
For example, to define a field group <code>MAKE_MODEL</code> containing fields <code>MAKE</code> and <code>MODEL</code>:
<p class="code">DEFINE FIELDGROUP MAKE_MODEL
<p class="code">DEFINE FIELDGROUP MAKE_MODEL
DEFINE FIELD MAKE WITH FIELDGROUP MAKE_MODEL AND ORDERED -
DEFINE FIELD MAKE WITH FIELDGROUP MAKE_MODEL AND ORDERED CHARACTER
CHARACTER
DEFINE FIELD MODEL WITH FIELDGROUP MAKE_MODEL
DEFINE FIELD MODEL WITH FIELDGROUP MAKE_MODEL
</p>
</p>
<p>Example of a field group within a field group:</p>
<p>
To define a field group within a field group:</p>
<p class="code">DEFINE FIELDGROUP BIRDS WITH FIELDGROUP VERTEBRATES</p>
<p class="code">DEFINE FIELDGROUP BIRDS WITH FIELDGROUP VERTEBRATES</p>


<b>Usage</b>
===Field considerations===
<p>Defining fields after defining the containing field group makes it possible to later add fields to an already defined field group, for example:</p>
<ul>
<li>Fields defined in a field group definition follow the syntax rules described in the [[DEFINE FIELD command]].</li>
 
<li>Field definitions must follow the definitions of their containing field group. It is then easier to add fields later to an already defined field group, for example:
<p class="code">DEFINE FIELD YEAR WITH FIELDGROUP MAKE_MODEL
<p class="code">DEFINE FIELD YEAR WITH FIELDGROUP MAKE_MODEL
</p>
</p> </li>
<p>The keyword AND on field definitions means that a field group name can contain blanks, just like a field name. You must use the AND keyword to separate the field group name from subsequent attributes:</p>
<p class="code">DEFINE FIELD COLOR WITH FIELDGROUP MAKE_MODEL AND ORDERED -
CHARACTER</p>


<p>The AND is unnecessary, if the FIELDGROUP <var class="term">FieldGroupName</var> clause is the last field attribute:</p>
<li>The keyword <var>AND</var> on field definitions means that a field group name can contain blanks, just like a field name.
<p class="code">DEFINE FIELD COLOR WITH ORDERED CHARACTER FIELDGROUP -
<p>
MAKE_MODEL</p>
To separate a field group name from subsequent field attributes, you must use the <var>AND</var> keyword: </p>
<p class="note"><b>Note</b>  
<p class="code">DEFINE FIELD COLOR WITH FIELDGROUP MAKE_MODEL AND ORDERED CHARACTER</p>
The MAKE_MODEL field group must be defined before defining the field(s) and/or field group(s) that belong with it.</p>
<p>
<p>The default attribute for frequency of occurrence for fields in a field group is EXACTLY-ONE, whereas the default for individually defined fields is REPEATABLE. Of course, you can declare a field inside a field group as REPEATABLE, as well as AT-MOST-ONE.</p>
The <var>AND</var> is unnecessary if the <var>FIELDGROUP <i>FieldGroupName</i></var> clause is the last field attribute:</p>
<p class="code">DEFINE FIELD COLOR WITH ORDERED CHARACTER FIELDGROUP MAKE_MODEL</p>
<p class="note"><b>Note:</b>  
The <code>MAKE_MODEL</code> field group must be defined before defining the field(s) and/or field group(s) that belong with it.</p></li>


<b>Usage notes</b>
<li>Once you define a field you cannot move it into or out of a fieldgroup using a <var>[[REDEFINE_command|REDEFINE]]</var> command. You must delete the field and relocate it by defining it again, locating it where you want it. </li>
<p>The fields defined in a field group definition follow the syntax rules described in the [[DEFINE FIELD command]].</p>
</ul>
<p>The WITH FIELDGROUP clause identifies a field group that is already defined.</p>
<p>Field group names must be unique among themselves and cannot have the same name as any field.</p>


Once you define a field you cannot move it into or out of a fieldgroup using a REDEFINE command. You must delete the field and relocate it by defining it again, locating it where you want it.
===Attribute considerations===
<p>
A field in a field group cannot have the <var>[[Field_design#Preallocated_fields_.28OCCURS_attribute.29|OCCURS]]</var> or <var>[[Field_design#VISIBLE_and_INVISIBLE_attributes|INVISIBLE]]</var> attribute. You can assign any other attributes you choose, paying attention to those that conflict with each other.</p>
<p>
The default attribute for frequency of occurrence for fields in a field group is <var>[[Field_design#Using_the_EXACTLY-ONE_.28EXONE.29_attribute|EXACTLY-ONE]]</var>, whereas the default for individually defined fields is <var>[[Field_design#AT-MOST-ONE.2C_REPEATABLE.2C_and_EXACTLY-ONE_attributes|REPEATABLE]]</var>. Of course, you can declare a field inside a field group as <var>REPEATABLE</var>, as well as <var>[[Field_design#Using_the_AT-MOST-ONE_attribute|AT-MOST-ONE]]</var>. </p>
<p>
The <var>REPEATABLE</var> and <var>AT-MOST-ONE</var> field attributes have different behavior for fields inside a field group. The <var>REPEATABLE</var> attribute means that the field can have more than one occurrence inside a field group occurrence, whereas the <var>AT-MOST-ONE</var> attribute means that the field can have only a single occurrence inside a field group occurrence. </p>


<p><b>Nested field groups</b></p>
===Nested field groups===
<p>Nested field groups are limited to 16 levels. The syntax for nesting is designed as follows:</p>
<p>Nested field groups are limited to 16 levels. The syntax for nesting is designed as follows:</p>
<p class="code">DEFINE FIELDGROUP VERTEBRATES
<p class="code">DEFINE FIELDGROUP VERTEBRATES
Line 56: Line 70:
DEFINE FIELDGROUP    SNAKES WITH FIELDGROUP REPTILES
DEFINE FIELDGROUP    SNAKES WITH FIELDGROUP REPTILES
</p>
</p>
<p><b>Attribute considerations</b></p>
<p>A field in a field group cannot have the OCCURS or INVISIBLE attribute. You can assign any other attributes you choose, paying attention to those that conflict with each other.</p>
<p>The REPEATABLE and AT-MOST-ONE field attribute have different behavior for fields inside a field group. The REPEATABLE attribute means that the field can have more than one occurrence inside a field group occurrence, whereas the AT-MOST-ONE attribute means that the field can have only a single occurrence inside a field group occurrence. The AT-MOST-ONE attribute is the default for fields inside a field group.</p>


==See also==
==See also==
<ul>
<ul>
<li>[[Field group design#Defining a field group|Defining a field group]] </li>
<li>[[Field group design#Defining a field group|Defining a field group]] </li>
<li>[[Processing multiply occurring fields and field groups#Working with field groups|Working with field groups]] </li>
<li>[[Data maintenance#Updating field groups|Updating field groups]] </li>
</ul>
</ul>


[[Category: File manager commands]]
[[Category: User commands]]
[[Category:Commands]]
[[Category:Commands]]

Latest revision as of 12:52, 12 February 2019

Summary

Status

Available as of Model 204 release 7.5

Privileges

Any user

Function

To establish the contents of a field group, including the fields and field groups associated with the field group being defined.

Syntax

DEFINE FIELDGROUP FieldGroupName [WITH FIELDGROUP OuterGroupName]

Where:

  • FieldGroupName specifies the name of the field group you are defining.

    A field group name must be unique among field group names, and it cannot have the same name as any field.

  • OuterGroupName specifies the name of another field group previously defined. The field group being defined is nested under the OuterGroupName.

For general syntax and usage notes that apply to all forms of the DEFINE command, see DEFINE command.

Adding fieldgroup contents

The WITH FIELDGROUP clause identifies a field group that is already defined. For example, to define a field group MAKE_MODEL containing fields MAKE and MODEL:

DEFINE FIELDGROUP MAKE_MODEL DEFINE FIELD MAKE WITH FIELDGROUP MAKE_MODEL AND ORDERED CHARACTER DEFINE FIELD MODEL WITH FIELDGROUP MAKE_MODEL

To define a field group within a field group:

DEFINE FIELDGROUP BIRDS WITH FIELDGROUP VERTEBRATES

Field considerations

  • Fields defined in a field group definition follow the syntax rules described in the DEFINE FIELD command.
  • Field definitions must follow the definitions of their containing field group. It is then easier to add fields later to an already defined field group, for example:

    DEFINE FIELD YEAR WITH FIELDGROUP MAKE_MODEL

  • The keyword AND on field definitions means that a field group name can contain blanks, just like a field name.

    To separate a field group name from subsequent field attributes, you must use the AND keyword:

    DEFINE FIELD COLOR WITH FIELDGROUP MAKE_MODEL AND ORDERED CHARACTER

    The AND is unnecessary if the FIELDGROUP FieldGroupName clause is the last field attribute:

    DEFINE FIELD COLOR WITH ORDERED CHARACTER FIELDGROUP MAKE_MODEL

    Note: The MAKE_MODEL field group must be defined before defining the field(s) and/or field group(s) that belong with it.

  • Once you define a field you cannot move it into or out of a fieldgroup using a REDEFINE command. You must delete the field and relocate it by defining it again, locating it where you want it.

Attribute considerations

A field in a field group cannot have the OCCURS or INVISIBLE attribute. You can assign any other attributes you choose, paying attention to those that conflict with each other.

The default attribute for frequency of occurrence for fields in a field group is EXACTLY-ONE, whereas the default for individually defined fields is REPEATABLE. Of course, you can declare a field inside a field group as REPEATABLE, as well as AT-MOST-ONE.

The REPEATABLE and AT-MOST-ONE field attributes have different behavior for fields inside a field group. The REPEATABLE attribute means that the field can have more than one occurrence inside a field group occurrence, whereas the AT-MOST-ONE attribute means that the field can have only a single occurrence inside a field group occurrence.

Nested field groups

Nested field groups are limited to 16 levels. The syntax for nesting is designed as follows:

DEFINE FIELDGROUP VERTEBRATES DEFINE FIELDGROUP BIRDS WITH FIELDGROUP VERTEBRATES DEFINE FIELDGROUP PARROTS WITH FIELDGROUP BIRDS DEFINE FIELDGROUP OWLS WITH FIELDGROUP BIRDS DEFINE FIELDGROUP REPTILES WITH FIELDGROUP VERTEBRATES DEFINE FIELDGROUP SNAKES WITH FIELDGROUP REPTILES

See also