TibrvMsgView.getFieldInstance()

Method

Declaration

TibrvMsgField getFieldInstance(
    java.lang.String fieldName,
    int instance)
  throws TibrvException

Purpose

Get a specific instance of a field from a message.

Remarks

When a message contains several field instances with the same field name, retrieve a specific instance by number (for example, get the ith field named foo). Programs can use this method in a loop that examines every field with a specified name.

The argument 1 denotes the first instance of the named field.

The method TibrvMsgView.extract() creates field objects for each field of the message snapshot. This returns one of those field objects.

When the instance argument is greater than the actual number of instances of the field in the message, this method returns null.

Release 5 Interaction

Rendezvous 5 (and earlier) did not support array datatypes. Some older programs circumvented this limitation by using several fields with the same name to simulate arrays. This work-around is no longer necessary, since release 6 (and later) supports array datatypes within message fields. The method TibrvMsgView.getFieldInstance() ensures backward compatibility, so new programs can still receive and manipulate messages sent from older programs. Nonetheless, we encourage programmers to use array types as appropriate, and we discourage storing several fields with the same name in a message.

Parameter

Description

fieldName

Get an instance of the field with this name.

null specifies the empty string as the field name.

instance

Get this instance of the specified field name. The argument 1 denotes the first instance of the named field.

See Also

TibrvMsgField

TibrvMsgView

TibrvMsgView.get()