Specifies filter conditions to be used by other classes when processing data. A filter has three components: a column, an operator, and a value or set of values. The condition is expressed as "value1 operator value2". For some operators, like "IN", the expression will be "value1 IN value2" where value2 is an array of strings.
Format numbers and date/time values in a locale neutral format, for example, "2.5" or "09/31/2008 01:02:03 AM".
String. The operator can be any operator. Table 44‑10 lists the valid filter operators and the number of arguments to pass to the constructor or setValues( ).
Table 44‑10 Filter operators
Operator
Description
Number of arguments
BETWEEN
Between an inclusive range
2
BOTTOM_N
Matches the bottom n values
1
BOTTOM_PERCENT
Matches the bottom percent of the values
1
EQ
Equal
1
FALSE
Matches false Boolean values
0
GREATER_THAN
Greater than
1
GREATER_THAN_OR_EQUAL
Greater than or equal
1
IN
Matches any value in a set of values
1+
LESS_THAN
Less than
1
LESS_THAN_OR_EQUAL
Less than or equal
1
LIKE
Search for a pattern
1
MATCH
Matches a pattern
1
NOT_BETWEEN
Not between an inclusive range
2
NOT_EQ
Not equal
1
NOT_IN
Does not match any value in a set of values
1+
NOT_LIKE
Search for values that do not match a pattern
1
NOT_MATCH
Does not match a pattern
1
NOT_NULL
Is not null
0
NULL
Is null
0
TOP_N
Matches the top n values
1
TOP_PERCENT
Matches the top percent of the values
1
TRUE
Matches true Boolean values
0
value1
String or array of strings. The first value to compare to the column value for the BETWEEN or NOT_BETWEEN operators.
value2
String or array of strings. This parameter is only required for the BETWEEN or NOT_BETWEEN operators.
Example
To select all of the rows matching a list of countries in their country fields, use code similar to the following:
var filter = new actuate.data.Filter("COUNTRY", actuate.data.Filter.IN,["Canada" , "USA", "UK", "Australia"]);
To create a filter to display only entries with a CITY value of NYC, use the following code:
var cityfilter = new actuate.data.Filter("CITY", actuate.data.Filter.EQ, "NYC");
String. Table 44‑10 lists the legal filter operator values.
Example
This example retrieves the name of the filter operator:
function retrieveFilterOperator(myFilter){
var myOp = myFilter.getOperator( );
return myOp;
}
getValues
Syntax
string Filter.getValues( )
string[ ] Filter.getValues( )
Returns the evaluated results of this filter. When the filter is constructed or set with a single argument, the returned value corresponds to the single argument. When two arguments or an array are set in the filter, the return value is an array of values.
Returns
String or array of strings. Returns the value or values from the filter.
Example
This example retrieves the name of the filter operator:
function retrieveValues(myFilter){
var myVals = myFilter.getValues( );
return myVals;
}
setColumnName
Syntax
void Filter.setColumnName(columnName)
Sets the name of the column to filter.
Parameter
columnName
String. The column name.
Example
This example sets the name of the column to filter to Sales:
function setFilterSales( myfilter ){
myfilter.setColumnName("Sales");
}
setOperator
Syntax
void Filter.setOperator(string operator)
Sets filter operator. The operator determines the comparison made between the data in the column and the value or values set in the filter.
Parameter
operator
String. The operator can be any valid operator. Table 44‑10 lists the valid filter operators and the number of arguments to pass to Filter.setValues( ).
Example
This example sets the filter to retrieve the bottom five values:
Sets string values for the filter to compare to the data in the column according to the operator. Table 44‑10 lists the valid filter operators and the values they use. Takes either one or two values, or one array of values.
Parameters
value
String. The value to compare to the column value.
value1
String. The first value to compare to the column value for the BETWEEN operator.
value2
String. The second value to compare to the column value for the BETWEEN operator.
values
Array of strings. The values to compare to the column value for the IN operator.
Example
This example sets the filter to retrieve values between 10 and 35: