Gets or sets an array of column names used to determine which columns will be populated when the search is executed.

Namespace:  ESRI.ArcGISExplorer.Data

Assembly:  ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)

Syntax

C#
public string[] ColumnSubset { get; set; }
Visual Basic (Declaration)
Public Property ColumnSubset As String()

Field Value

A string Array object containing the names of the columns to populate with data.

Remarks

The RowCollection which is returned from the Search method always contains all the columns in the Table but the ColumnSubset property can be used to determine which columns in the RowCollection will be populated with data. For large tables containing many columns, setting this property can significantly improve the query performance.

Examples

The code below illustrates how to use the ColumnSubset property to only return data for the specified columns when a query is executed.
CopyC#
  //Open the table
Table demographicsTable = Table.OpenFileGeodatabaseTable(@"C:\Data\World.gdb", "demographics");

  //Define the search 
  Filter searchCriteria = new Filter();
  searchCriteria.WhereClause = "LIFE_EXP > 70";
  //Set the ColumnSubset property so only the specified columns will contain data
  searchCriteria.ColumnSubset = new string[] {"ABBREVNAME", "LIFE_EXP"};

  //Execute query
  RowCollection searchedRows = demographicsTable.Search(searchCriteria);  

  //Get the first Row returned from the query
  Row resultRow1 = searchedRows.GetFirst();

  //All columns in the Table are returned
  System.Diagnostics.Debug.Print(resultRow1.Table.Columns.Count.ToString());  //Prints "29"

  //But only ABBREVNAME and LIFE_EXP contain data.
  if (resultRow1.Values["ABBREVNAME"] != null)
  {
    System.Diagnostics.Debug.Print(resultRow1.Values["ABBREVNAME"].ToString()); //Prints "Albania"
  }

  if (resultRow1.Values["LIFE_EXP"] != null)
  {
    System.Diagnostics.Debug.Print(resultRow1.Values["LIFE_EXP"].ToString());   //Prints "72"
  }

  //For example, the TOTAL_POP value is null
  if (resultRow1.Values["TOT_POP"] != null)
  {
    System.Diagnostics.Debug.Print(resultRow1.Values["TOTAL_POP"].ToString());
  }
  else
  {
    System.Diagnostics.Debug.Print("Value is null");                            //Prints "Value is null"
  }
CopyVB.NET
'Open the table
Dim demographicsTable As Table = Table.OpenFileGeodatabaseTable("C:\Data\World.gdb", "demographics")

'Define the search 
Dim searchCriteria As Filter = New Filter()
searchCriteria.WhereClause = "LIFE_EXP > 70"
'Set the ColumnSubset property so only the specified columns will contain data
searchCriteria.ColumnSubset = New String() {"ABBREVNAME", "LIFE_EXP"}

'Execute query
Dim searchedRows As RowCollection = demographicsTable.Search(searchCriteria)

'Get the first Row returned from the query
Dim resultRow1 As Row = searchedRows.GetFirst()

'All columns in the Table are returned
System.Diagnostics.Debug.Print(resultRow1.Table.Columns.Count().ToString())       'Prints "29"


'But only ABBREVNAME and LIFE_EXP contain data.
If Not resultRow1.Values.Item("ABBREVNAME") Is Nothing Then
  System.Diagnostics.Debug.Print(resultRow1.Values.Item("ABBREVNAME").ToString()) 'Prints "Albania"
End If

If Not resultRow1.Values.Item("LIFE_EXP") Is Nothing Then
  System.Diagnostics.Debug.Print(resultRow1.Values.Item("LIFE_EXP").ToString())   'Prints "Albania"
End If

'For example, the TOTAL_POP value is null
If Not resultRow1.Values.Item("TOTAL_POP") Is Nothing Then
  System.Diagnostics.Debug.Print(resultRow1.Values.Item("TOTAL_POP").ToString())  'Prints "Albania"
Else
  System.Diagnostics.Debug.Print("Value is nothing")                              'Prints "Value is Nothing"
End If

See Also