GetFieldName Method

Log Parser

GetFieldName Method

Returns the name of an input record field.

C++ Syntax

HRESULT STDMETHODCALLTYPE GetFieldName(IN DWORD fIndex, OUT BSTR *pbszFieldName);

Script Syntax

fieldName = GetFieldName(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

A string value containing the name of the input record field at the specified position.


Examples

C++ example:

HRESULT CProcessesInputContext::GetFieldName(IN DWORD fIndex, OUT BSTR *pbszFieldName)
{
    switch(fIndex)
    {
        case 0:    {
                        *pbszFieldName = SysAllocString(L"ImageName");
                        break;
                   }

        case 1:    {
                        *pbszFieldName = SysAllocString(L"PID");
                        break;
                   }

        case 2:    {
                        *pbszFieldName = SysAllocString(L"ParentPID");
                        break;
                   }

        case 3:    {
                        *pbszFieldName = SysAllocString(L"Threads");
                        break;
                   }
    }

    return S_OK;
}

VBScript example:

Function GetFieldName(nFieldIndex)

	Select Case nFieldIndex
		Case 0 
			GetFieldName = "QFE"
		Case 1
			GetFieldName = "Description"
		Case 2
			GetFieldName = "InstallDate"
		Case 3
			GetFieldName = "InstalledBy"
		Case 4
			GetFieldName = "Comments"
		Case 5
			GetFieldName = "SP"
	End Select

End Function


See also:

ILogParserInputContext Interface
GetFieldType Method
Run Time Interaction
Custom Plugins


© 2004 Microsoft Corporation. All rights reserved.