The table below describes the methods and properties provided with the field object. These methods and properties are used to access
subfields in Chameleon.
Method/Property
Purpose
clear()
Clears the field and all of its subfields.
count_of_subfield(RepeatIndex)
If RepeatIndex is not specified, count_of_subfield returns the number of subfields
in the field.
If RepeatIndex is specified, and the field is a repeated field,
RepeatIndex specifies which of the repeated fields to examine; 0 represents the
first repeated field, 1 the second, and so on. In this case, count_of_subfield returns
the number of subfields in the specified repetition of the field.
count_of_repeat()
Returns the number of times the field repeats.
is_null()
Returns True if the current object contains no subfields. If one or more subfields exist, False is returned.
subfield(SubFieldIndex, SubSubFieldIndex)
If SubSubFieldIndex is not specified, subfield returns a field object representing
the subfield at index SubFieldIndex. (Note that indexing starts at 0:
the first subfield is at index 0, the second is at 1, and so on.)
If SubSubFieldIndex is specified, subfield returns a field object
representing subsubfield SubSubFieldIndex of subfield SubFieldIndex.
repeat_field(RepeatIndex)
Returns the repetition of the field specified by
RepeatIndex.
Note that indexing starts from 0: a RepeatIndex of 0 specifies the first
repetition of the field, 1 specifies the second repetition, and so on.
If the field is not repeated, a RepeatIndex of 0 references the field.
field.value and field.repeat_field(0).value are always identical.
value
If no subfields are defined for this field, the value property gets and sets the value of the field object. If the field contains subfields, value gets and sets
the first subfield of the field.
set_count_of_repeat(count)
Sets the number of repeats for the field. This must be a positive integer. A count of 0
generates an exception.
set_count_of_subfield(count)
Sets the number of subfields for the field. This must be a non-negative integer. A count of 0
removes all subfields from the field.
In some cases, the behavior of these properties and methods depends on the version of the
Chameleon parser that you are using. For information on how the field object properties and methods
behave in different versions of the parser, see
Field Object Behavior in Parser Versions.