GetValue Method

Returns the value of an input record field.


C++ Syntax

HRESULT STDMETHODCALLTYPE GetValue(IN DWORD fIndex, OUT VARIANT *pvarValue);

Script Syntax

value = GetValue(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 VARIANT containing the value of the specified field.
The VARIANT type must match the Log Parser data type declared by the GetFieldType method, as shown in the following table:
Declared Field Type C++ VARIANT Type VBScript Type
INTEGER VT_I8 (also compatible: VT_I4) Long (VT_I4)
REAL VT_R8 Double (VT_R8)
STRING VT_BSTR String (VT_BSTR)
TIMESTAMP VT_DATE (also compatible: VT_I8, VT_I4 containing the number of 100-nanosecond intervals since January 1, year 0) Date (VT_DATE)
NULL VT_NULL (also compatible: VT_EMPTY) Null (VT_NULL)

Remarks


Examples

C++ example:

HRESULT CProcessesInputContext::GetValue(IN DWORD fIndex, OUT VARIANT *pvarValue)
{
	// Initialize return value
	VariantInit( pvarValue );


	switch(fIndex)
	{
		case 0: {
					// ImageName
					V_VT( pvarValue ) = VT_BSTR;
					V_BSTR( pvarValue ) = SysAllocString( m_processEntry32.szExeFile );
					break;
			}

		case 1: {
					// PID
					V_VT( pvarValue ) = VT_I4;
					V_I4( pvarValue ) = m_processEntry32.th32ProcessID;
					break;
			}

		case 2: {
					// ParentPID
					V_VT( pvarValue ) = VT_I4;
					V_I4( pvarValue ) = m_processEntry32.th32ParentProcessID;
					break;
			}

		case 3: {
					// Threads
					V_VT( pvarValue ) = VT_I4;
					V_I4( pvarValue ) = m_processEntry32.cntThreads;
					break;
			}
}

	return S_OK;
}

VBScript example:

Function GetValue(nFieldIndex)

	Select Case nFieldIndex

		Case 0 
			' QFE
			GetValue = m_objQFEArray(m_nIndex).HotFixID
		Case 1
			' Description
			GetValue = m_objQFEArray(m_nIndex).Description
		Case 2
			' InstallDate
			GetValue = m_objQFEArray(m_nIndex).InstallDate
		Case 3
			' InstalledBy
			GetValue = m_objQFEArray(m_nIndex).InstalledBy
		Case 4
			' Comments
			GetValue = m_objQFEArray(m_nIndex).FixComments
		Case 5
			' SP
			GetValue = m_objQFEArray(m_nIndex).ServicePackInEffect

	End Select

End Function

See also:

ILogParserInputContext Interface
ReadRecord Method
Run Time Interaction
Custom Plugins

© 2004 Microsoft Corporation. All rights reserved.