SetFolderSearchFieldData method

The search operator and values are set for the specified field for the active folder.

Method
short SetFolderSearchFieldData(
char * pFieldName,
short operator,
char * pValue1,
char * pValue2 )
Parameters
pFieldName
Points to a null-terminated character string containing the name of a search field for the active folder.
operator
Specifies the search operator to be used. This must be one of the following operator values found in ARSOLEEX.H:
  ARS_OLE_OPR_EQUAL
  ARS_OLE_OPR_NOT_EQUAL
  ARS_OLE_OPR_LESS_THAN
  ARS_OLE_OPR_LESS_THAN_OR_EQUAL
  ARS_OLE_OPR_GREATER_THAN
  ARS_OLE_OPR_GREATER_THAN_OR_EQUAL
  ARS_OLE_OPR_BETWEEN
  ARS_OLE_OPR_NOT_BETWEEN
  ARS_OLE_OPR_IN
  ARS_OLE_OPR_NOT_IN
  ARS_OLE_OPR_LIKE
  ARS_OLE_OPR_NOT_LIKE
pValue1
Points to a null-terminated character string containing the first, or only, value to be set for the field.
pValue2
Points to a null-terminated character string containing the second value to be set for the field. This parameter is ignored unless the operator is ARS_OLE_OPR_BETWEEN or ARS_OLE_OPR_NOT_BETWEEN.
Description
The search operator and values are set for the specified field for the active folder.
Return Value
Refer to return codes.
See Also
GetNumFolderSearchFields and GetFolderSearchFieldNames, SearchFolder method

C/C + +

The following example retrieves the names of the active folder search fields, gives a user the opportunity to set the values for these fields, and initiates a search of the folder.
 CArsOle * pArsCtrl;
 ArsOleName * pNames;
 CListBox * pFieldList, * pOprList;
 CEdit * pValue1, * pValue2;
 char name[ sizeof( ArsOleName ) ];
 char value1[ sizeof( ArsOleValue ) ];
 char value2[ sizeof( ArsOleValue ) ];
 short rc, j, opr, num_fields;
 VARIANT vari;
   .
   .
 struct _OprMap
 {
   short  code;
   char * pText;
 } OprMap

 static OprMap Oprs[] =
   { { ARS_OLE_OPR_EQUAL,                  "Equal" },
     { ARS_OLE_OPR_NOT_EQUAL,              "Not Equal" },
          .
          .
     { ARS_OLE_OPR_LIKE,                   "Like" },
     { ARS_OLE_OPR_NOT_LIKE,               "Not Like" } };

 #define NUM_OPRS  ( sizeof(Oprs) / sizeof(OprMap) )
   .
   .
 // During dialog initialization:

 rc = pArsCtrl->GetNumFolderSearchFields( &vari );
 if ( rc != ARS_OLE_RC_SUCCESS )
   ERROR;
 num_fields = var.iVal;

 pNames = new ArsOleName[ max( num_fields, 1 ) ];
 rc = pArsCtrl->GetFolderSearchFieldNames( (IUnknown*)pNames, num_fields );
 if ( rc != ARS_OLE_RC_SUCCESS )
   ERROR;

 for ( j = 0; j < num_fields; j++ )
   pFieldList->InsertString( -1, pNames[j] );
 pFieldList->SetCurSel( 0 );

 for ( j = 0; j < NUM_OPRS; j++ )
 {
   pOprList->InsertString( -1, Oprs[j].pText );
   pOprList->SetItemData( j, (DWORD)Oprs[j].code );
 }
 pOprList->SetCurSel( 0 );
   .
   .
 // During SET FIELD button processing:

 pFieldList->GetText( pFieldList->GetCurSel( ), name );
 opr = (short)pOprList->GetItemData( pOprList->GetCurSel( ) );
 pValue1->GetWindowText( value1, sizeof(value1) );
 pValue2->GetWindowText( value2, sizeof(value2) );

 rc = pArsCtrl->SetFolderSearchFieldData( name, opr, value1, value2 );
 if ( rc != ARS_OLE_RC_SUCCESS )
   ERROR;
   .
   .
 // During OK button processing:

 rc = pArsCtrl->SearchFolder( FALSE );
 if ( rc != ARS_OLE_RC_SUCCESS )
   ERROR;
   .
   .

Visual Basic

Dim rc, count, i, j As Integer
Dim num_fields, num_docs As Variant
Dim Names() As String
Dim Line As String
Dim Temp As String
Dim Oprs As Variant

 .
 .

Oprs = Array ("Equal", "Not Equal", ..., "Like", "Not Like")

rc = ArsOle.GetNumFolderSearchFields(num_fields)
If rc <> ARS_OLE_RC_SUCCESS Then
    MsgBox "ERROR"
    End
End If

ReDim Names(num_fields)

For count = 1 To num_fields
    rc = ArsOle.GetFolderSearchFieldName(count, Temp)
    Names(count) = Temp
Next count

for count = 1 To num_fields
    lbFieldList.AddItem Names(count)
Next count

for count = 1 To UBound(Oprs)
    lbOprList.AddItem (Oprs(count))
Next count
 .
 .
 .
' During SET FIELD button processing
rc = ArsOle.SetFolderSearchFieldData (lbFieldList.List(lbFieldList.ListIndex),
                                      lbOprList.ListIndex,
                                      txtValue1.Value,
                                      txtValue2.Value)
If rc <> ARS_OLE_RC_SUCCESS Then
    MsgBox "ERROR"
    End
End If

'During OK button processing:

rc = ArsOle.SearchFolder (False)
If rc <> ARS_OLE_RC_SUCCESS Then
    MsgBox "ERROR"
    End
End If