Open topic with navigation

TIBCO Rendezvous® 8.8.0

# Message.GetField

Method

## Visual Basic

    Overloads Public Function GetField(
        ByVal fieldName As String)
    Overloads Public Function GetField(
        ByVal messageField As MessageField,
        ByVal fieldId As UInt16)

## C#

    public MessageField GetField(
        string fieldName);
    public MessageField GetField(
        string fieldName,
        ushort fieldId);

## Purpose

Get a specified field from a message.

## Remarks

Programs specify the field to retrieve using the `fieldName` and `fieldId` parameters.

The method takes a snapshot of the field, and returns that information as a MessageField object. To obtain the value of the field, programs can either extract the Value property from the MessageField object explicitly, or implicitly extract its Value by assigning the object to a variable; see Implicit Conversions.

Programs can use a related method to loop through all the fields of a message; to retrieve each field by its integer index number, see Message.GetFieldByIndex.

Parameter | Description
``fieldName`` | Get a field with this name.
``fieldId`` | Get the field with this identifier. The constant `MessageField.NoSpecificId` (zero) is a special value; it indicates the absence of any identifier to the field search algorithm.

## Field Search Algorithm

This method, and related methods that get message fields, all use this algorithm to find a field within a message, as specified by a field identifier and a field name.

Procedure

| 1. | If the program supplied `MessageField.NoSpecificId (zero) as the identifier, or omitted any identifier, then begin at step 3.`

If the program supplied a non-zero field identifier, then search for the field with that identifier.

If the search succeeds, return the field.

On failure, continue to step 2.

| 2. | If the identifier search (in step 1) fails, and the program supplied a non-null field name, then search for a field with that name.

If the name search succeeds, and the identifier in the field is null, return the field.

If the name search succeeds, but the actual identifier in the field is non-null (so it does not match the identifier supplied) then throw an exception with the status code `IDConflict.`

On failure, or if the program supplied null as the field name, return `null`.

| 3. | When the program supplied `MessageField.NoSpecificId (zero) as the identifier, or omitted any identifier, then begin here.`

Search for a field with the specified name—even if that name is null.

If the search succeeds, return the field.

On failure, return `null`.

If a message contains several fields with the same name, searching by name finds the first instance of the field with that name.

## Extracting Fields from a Nested Message

Earlier releases of Rendezvous software allowed programs to get fields from a nested submessage by concatenating field names. Starting with release 6, Rendezvous software no longer supports this special case convenience. Instead, programs must separately extract the nested submessage using Message.GetField (or a related method), and then get the desired fields from the submessage.

## Method Forms

With only a field name, find the field by name. If the field name is not present in the message, return null. If several fields with that name are present in the message, this method returns the first one that it finds.

With only a field identifier, find the field with that identifier (since identifiers are unique, the message can contain at most one such field). If the identifier is not present in the message, return null.

With both a field name and a field identifier, search first by identifier, and then by field name. If neither are present in the message, return null. If identifier search succeeds, return the field value. If the name search succeeds, but the actual identifier in the field is non-zero (so it does not match the identifier supplied) then throw a RendezvousException with status code IDConflict.

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.