Class actuate.data.Filter
Description
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."
Constructor
Syntax
Parameters
String. The operator can be any operator. Table 4-9 lists the valid filter operators and the number of arguments to pass to the constructor or setValues( ).
Table 4-9 Filter operators Matches the bottom n values Matches the bottom percent of the values Matches False Boolean values Matches any value in an set of values. Not between an inclusive range Does not match any value in a set of values Search for values that do not match a pattern Matches the top percent of the values Matches True Boolean valuesString or array of Strings. The first value to compare to the column value for the BETWEEN or NOT_BETWEEN operators.
String or array of Strings. The second value to compare to the column value 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");Function summary
Table 4-10 lists actuate.data.Filter functions.
Table 4-10 actuate.data.Filter functionsactuate.data.Filter.getColumnName
Syntax
Returns
Example
This example retrieves the name of the column.
function retrieveColumnName(myFilter){actuate.data.Filter.getOperator
Syntax
Gets the filter operator. Table 4-9 lists the legal filter operator values.
Returns
Example
This example retrieves the name of the filter operator.
function retrieveFilterOperator(myFilter){actuate.data.Filter.getValues
Syntax
Returns the value or values of the filter. When a single argument is passed to getValues( ), the returned value corresponds to the single argument. When two arguments or an array are passed to getValues( ), the return value is an array of values.
Returns
Example
This example retrieves the name of the filter operator.
function retrieveValues(myFilter){actuate.data.Filter.setColumnName
Syntax
Sets the name of the column to filter.
Parameters
Example
This example sets the name of the column to filter to Sales.
actuate.data.Filter.setOperator
Syntax
Sets filter operator. The operator determines the comparison to make between the data in the column and the value or values set in the filter. Table 4-9 lists the possible values.
Parameters
String. The operator can be any operator. Table 4-9 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.
actuate.data.Filter.setValues
Syntax
Sets string values for the filter to compare to the data in the column according to the operator. Table 4-9 lists the valid filter operators and the values they use. Takes either one or two values, or one array of values.
Parameters
String. The value to compare to the column value.
String. The first value to compare to the column value for the BETWEEN operator.
String. The second value to compare to the column value for the BETWEEN operator.
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.
(c) Copyright Actuate Corporation 2011 |
![]() |