Open topic with navigation

TIBCO Rendezvous® 8.8.0

# TibrvMsg::getFieldInstance()

Method

## Declaration

    TibrvStatus getFieldInstance(
        const char*       fieldName,
        TibrvMsgField&    fieldAddr,
        tibrv_u32         instance);

## Purpose

Get a specified 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 `i` th 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 copies scalar data into the program’s field object. Pointer data extracted from the field remain valid until the message is destroyed; that is, even removing the field or updating the field’s value does not invalidate pointer data.

When the `instance` argument is greater than the actual number of instances of the field in the message, this method returns the status code TIBRV_NOT_FOUND.

## 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 TibrvMsg::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.
`fieldAddr` | The program supplies a TibrvMsgField object; the method overwrites the contents of the object, using information from the message field.
`instance` | Get this instance of the specified field name. The argument `1` denotes the first instance of the named field.

## See Also

TibrvMsg::getField()

Did you find this helpful?

Yes No
Great!
Thanks for taking the time to give us some feedback.
Sorry about that

Why wasn't this helpful? (check all that apply)

Could not find what I was looking for
Instructions confusing or unclear
Instructions did not work

Want to tell us more?

Please select at least one option or provide details about the issue!!

Error occurred while submitting feedback.

Error2 occurred while submitting feedback.

TIBCO Rendezvous®

Copyright © 1997-2025. Cloud Software Group, Inc. All Rights Reserved.