forwardSession-level Dialects   Table of ContentUsing QuickFIX Dialectsforward
Dialect Exploration

The Dialect class exposes services to access information about the content of a specialized FIX dialect or standard FIX messaging specification. These services allow to obtain the types of specific dialect or standard FIX messages, and to explore the entire message structure, as well as to retrieve names of arbitrary fields by tag numbers.

Accessing Fields Information

The following members are present for basic field information manipulation:

Example
C#
using FIXForge.NET.FIX;

Dialect stdFIX44 = new Dialect(ProtocolVersion.FIX44);

int sideTag = FIX44.Tags.Side;
string tagName = stdFIX44.TagNameByNumber(sideTag);

Console.WriteLine("Field '{0}' (# {1}) has following valid values:", tagName, sideTag);

foreach (ValidFieldValue valueInfo in stdFIX44.GetValidFieldValues(sideTag))
    Console.WriteLine(String.Format("{0} ({1})", valueInfo.Value, valueInfo.Description));
VB
Imports FIXForge.NET.FIX

Dim stdFIX44 As New Dialect(FIXForge.NET.FIX.ProtocolVersion.FIX44)
Dim sideTag As Int = FIXForge.NET.FIX.FIX44.Tags.Side
Dim tagName As String = stdFIX44.TagNameByNumber(sideTag)
Dim valueInfo As ValidFieldValue

Console.WriteLine("Field '{0}' (# {1}) has following valid values:", tagName, sideTag)

For Each valueInfo In stdFIX44.GetValidFieldValues(sideTag)
    Console.WriteLine(String.Format("{0} ({1})", valueInfo.Value, valueInfo.Description))
Next valueInfo
Exploring Dialect Messages Structure

To explore message-related information, the following members are exposed by the Dialect class:

  • MessageTypes returns a collection of types of all messages available in the FIX message specification or FIX dialect for which the class instance was created.
  • MessageNameByType(String) finds the name of a message by its type.
  • GetMessageFields(String) returns information about all fields available in the specific message.

Example

The following example demonstrates how fields, which make up a message, can be traversing.

C#
using FIXForge.NET.FIX;

void TraverseFields(FieldInfo[] fields, int shift)
{
    String spaces = new String(' ', shift);

    foreach(FieldInfo field in fields)
    {
        Console.WriteLine(
            "{0}{1} (required={2})",
            spaces, field.Tag, field.IsRequired);

        TraverseChildFields(field.ChildFields, 2 + shift);
    }
}

public void TraverseMessages(Dialect dialect)
{
    foreach(string msgType in dialect.MessageTypes)
    {
        Console.WriteLine(
            "Traversing {0} (MsgType={1})..",
            dialect.MessageNameByType(msgType), msgType);

        TraverseFields(dialect.GetMessageFields(msgType), 0);
    }
}
VB
Imports FIXForge.NET.FIX

Sub TraverseFields(ByVal fields() As FieldInfo, ByVal shift As Integer)
    Dim spaces As New String(" ", shift)
    Dim field As FieldInfo

    For Each field In fields
        Console.WriteLine( _
            "{0}{1} (required={2})", _
            spaces, field.Tag, field.IsRequired)

        TraverseFields(field.ChildFields, 2 + shift)
    Next fInfo
End Sub

Public Sub TraverseMessages(ByVal fixDialect As Dialect)
    Dim msgType As String

    For Each msgType In fixDialect.MessageTypes
        Console.WriteLine( _
            "Traversing {0} (MsgType={1})..", _
            dialect.MessageNameByType(msgType), msgType)

        TraverseFields(dialect.GetMessageFields(msgType), 0)
    Next msgType
End Sub