next up previous contents
Next: ConstrainColumnLessThanEqual Up: Searching Methods Previous: SearchColumns

ConstrainColumnLessThan

NAME ConstrainColumnLessThan

PROTOTYPE

#include "SSTable.h"

ReVarPCifArray<int> * SSTable::ConstrainColumnLessThan(
                                 CifString & target,
                                 CifString & colName,
                                 int & errCode);

EXAMPLE

#include "SSTable.h"

CifString cs("30.00"), col1("twist");
int errCode = 0;
SSTable s("MyTable");
...
s.SetFlags(SSTable::DT_DOUBLE, s.GetColumnIndex(col1.Text()));
s.SetPrecision(2, s.GetColumnIndex(col1.Text()));

ReVarPCifArray<int> * iArray;
iArray = s.ConstrainColumnLessThan(cs, col1, errCode);
if (iArray) {
  for (int i = 0; i < iArray->Length(); i++) {
    // do something to each row with twist < 30.00
  }
}
PURPOSE

ConstrainColumnLessThan returns the row indices of cells in a column that are less than the target value. You can only search a column that was constructed with a tree index. The search is dictated by the datatype of the column, since, strings, integers, and doubles get compared differently.

RECEIVES

target The target value to compare to.
colName The name of the column to search.
errCode A reference to an integer holding the error code resulting from this operation.

RETURN VALUE

A pointer to a ReVarPCifArray<int> holding the row indices of the cells containing a value less than the target.
A NULL value indicates a possible error or an unsuccessful search.
A negative value in errCode indicates an error or warning.

REMARKS

See also: ConstrainColumnLessThanEqual



Olivera Tosic
12/17/1999