CTRecord::SetFilter
Sets or clears a record filter condition.
Declaration
void CTRecord::SetFilter(const CTString& cndexpr);
Description
int atoi( char* String ) |
ASCII to integer. |
int atol( char* String ) |
ASCII to long. |
double atof( char* String ) |
ASCII to float. |
int cabs( into Value ) |
Calculate the absolute value of a complex number. |
int labs( into Value ) |
Calculate the absolute value of a long integer. |
double fabs( double Value ) |
Calculate the absolute value of a float. |
double ceil( double Value ) |
Calculate the ceiling of a value. |
double floor( double Value ) |
Calculate the floor of a value. |
double fmod( double r, double t ) |
Calculate the floating-point remainder. |
int strlen( char* String ) |
Get the length of a string. |
int strcmp( char* s, char* t ) |
Compare strings. |
int stricmp( char* s, char* t ) |
Compare strings without regard to case. |
int strncmp( char* s, char* t, int length ) |
Compare characters of two strings. |
int strnicmp( char* s, char *t, int length ) |
Compare characters of two strings without regard to case. |
Description
CTRecord::SetFilter() is used to set the filtering for a table. When set, all records retrieved from the table will be filtered against the expression, and just those records that match this criteria will be returned. Notice that this feature will be temporary, and just the user who sets the filter will have its records filtered. The filter is turned off when the table is closed, or when CTRecord::SetFilter() is called with NULL in the parameter cndexpr. If a new expression is set to a table with a current filter, the old filter is replaced with the new one. Only one filter may be active per table per user at a given time.
When used in the client/server model, this feature has the potential to increase the performance because only the records matching the criteria will be returned, reducing the network traffic. If used in conjunction with sets (CTRecord::RecordSetOn()), it it may behave as a simple query.
Return
void
Example
// scan all records from California
void ScannAllRecord(CTTable &hTable)
{
CTRecord hRecord(hTable);
hRecord.SetFilter("stricmp(state, \"CA\") == 0");
if (hRecord.First())
{
do
{
DisplayRecord(hRecord);
}
while (hRecord.Next());
}
}
See Also
CTRecord::GetFilter(), CTRecord::IsFiltered()