GetFieldType Method

Log Parser

GetFieldType Method

Returns the type of an input record field.

C++ Syntax

HRESULT STDMETHODCALLTYPE GetFieldType(IN DWORD fIndex, OUT DWORD *pnFieldType);

Script Syntax

fieldType = GetFieldType(fIndex);


Parameters

fIndex
The 0-based index of the input record field. The index value is guaranteed to be smaller than the number of fields returned by the GetFieldCount method.


Return Value

An integer value from the FieldType enumeration containing the Log Parser data type of the input record field at the specified position.


Examples

C++ example:

HRESULT CProcessesInputContext::GetFieldType(IN DWORD fIndex, OUT DWORD *pnFieldType)
{
    switch(fIndex)
    {
        case 0:    {
                        // ImageName
                        *pnFieldType = ILogParserInputContext::String;
                        break;
                   }

        case 1:    {
                        // PID
                        *pnFieldType = ILogParserInputContext::Integer;
                        break;
                   }

        case 2:    {
                        // ParentPID
                        *pnFieldType = ILogParserInputContext::Integer;
                        break;
                   }

        case 3:    {
                        // Threads
                        *pnFieldType = ILogParserInputContext::Integer;
                        break;
                   }
    }

    return S_OK;
}

VBScript example:

Function GetFieldType(nFieldIndex)

	Select Case nFieldIndex
		Case 0 
			' String
			GetFieldType = 3
		Case 1
			' String
			GetFieldType = 3
		Case 2
			' Timestamp
			GetFieldType = 4
		Case 3
			' String
			GetFieldType = 3
		Case 4
			' String
			GetFieldType = 3
		Case 5
			' String
			GetFieldType = 3

	End Select

End Function


See also:

ILogParserInputContext Interface
GetFieldName Method
Run Time Interaction
Custom Plugins


© 2004 Microsoft Corporation. All rights reserved.