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
- Any value can be returned as a VT_NULL or VT_EMPTY VARIANT (a Null VBScript variable) to indicate a NULL value, regardless of the field type declared by the GetFieldType method.
- Due to query execution optimizations, there is no guarantee that the GetValue method
will be called for all the fields of an input record. In fact, the GetValue method will
only be called for those fields that are referred to by the currently executing query.
For example, if a query refers to two fields only out of an input record made up of ten fields, then the GetValue method will be called for those two fields only.
If a query does not refer to any input record field (e.g. "SELECT COUNT(*)"), then the GetValue method will never be called.
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 InterfaceReadRecord Method
Run Time Interaction
Custom Plugins