Product Documentation

VCL/CLX Developers Guide

Previous Topic

Next Topic

Filters

c-treeVCL/CLX allows the user to define filters on the record. When a filter is set, all records retrieved from the table will be filtered against the given expression, and just those records that match the filter criteria will be returned.

A filter is activated by setting the table Filter property with a string containing the filter expression and setting the table Filtered property to true. Only the user who sets the filter will have its records filtered.

The filter is turned off when the table is closed, or when the Filtered property is set to false. Just one filter may be active per table per user at once, so if a new filter is set, the old filter will be overridden.

When used in the client/server model, this feature has the potential to increase the performance since just the records matching the criteria will be returned, reducing the network traffic.

Previous Topic

Next Topic

Constants

The expression parser uses the constants below internally as a 32-bit signed or unsigned integer:

  • Character constants: any valid char enclosed in single quotes, e.g., 'a'
  • Signed Integer constants: values from - 2,147,438,647 to 2,147,438,647
  • Unsigned Integer constants: values from 0 to 4,294,967,295
  • Hexadecimal constants: values from 0x00000000 to 0xffffffff. Any combination of lower case or upper case letters are accepted, e.g., 0Xbc4f or 0xF5C56d

Any integer larger than the maximum size allowed for integers, or any number with decimal points, or any numbers in scientific notation are interpreted as a floating point constant by the expression parser .

String constants are similar to C string constants and represent any text enclosed by double quotes, for example, "This is a string". The maximum size of a string constant defaults to 255 characters. The filter expression parser allows the following escape characters in string constants or character constants:

Escape char

Value

Explanation

\a or \A

ASCII 7

bell

\b or \B

ASCII 8

backspace

\f or \F

ASCII 12

Form Feed

\n or \N

ASCII 10

Linefeed

\r or \R

ASCII 13

Carriage Return

\t or \T

ASCII 9

tab

\v or \V

ASCII 11

vertical tab

\\

 

 

\any

 

Any character not listed above

Previous Topic

Next Topic

Variables

A filter expression variable is actually the name of the fields defined for the table. There is a limit of 128 characters for the name of variables and the names are case sensitive.

When a user specifies a variable name, the filter parser searches the table definition for a field of that name. The parser uses the type of the field and converts it to the types used internally by the expression evaluator. The conversion of field types is as follows:

Field Type

Data Type

Field Type

Data Type

CT_BOOL

int

CT_SFLOAT

double

CT_CHAR

int

CT_DFLOAT

double

CT_CHARU

unsigned

CT_FSTRING

char*

CT_INT2

int

CT_FPSTRING

char*

CT_INT2U

unsigned

CT_F2STRING

char*

CT_INT4

int

CT_F4STRING

char*

CT_INT4U

unsigned

CT_STRING

char*

CT_DATE

unsigned

CT_PSTRING

char*

CT_TIME

unsigned

CT_2STRING

char*

CT_MONEY

int

CT_4STRING

char*

Please note that "int" is a LONG, "unsigned" is a ULONG and "char*" is a pTEXT.

Field names that match a valid expression reserved word:

Consider a field named "year", which collides with the function YEAR. The expression "[year] == 2000" is needed to handle "year" as a field name rather than the function.

TOCIndex