EQL record filters are specified with WHERE clause types of Boolean expressions.
<DataSourceFilterString>WHERE booleanExpression</DataSourceFilterString> <SelectionFilterString>WHERE booleanExpression</SelectionFilterString>
The expression uses one or more attributes whose values are to be tested, and one or more test conditions. For example, the expression can use numeric and string value comparison operators, NULL value evaluation operators, and logical operators, as listed in the following table. Note that unlike an EQL statement, the WHERE keyword is not used in the query string.
Operator | Description | Example |
---|---|---|
= | Equal (tests the equality between two expressions) | COUNTRY_NAME = 'France' |
<> | Not equal (tests the condition of two expressions not being equal to each other) | PROD_WEIGHT_CLASS <> 2 |
> | Greater than (tests the condition of one expression being greater than the other) | PROD_MIN_PRICE > 1000 |
< | Less than (tests the condition of one expression being less than the other) | QUANTITY_SOLD < 500 |
>= | Greater than or equal (tests the condition of one expression being greater than or equal to the other expression) | PROD_MIN_PRICE >= 75 |
<= | Less than or equal (tests the condition of one expression being less than or equal to the other expression) | PROMO_COST <= 1500 |
BETWEEN low AND high | Specifies an inclusive range of values. Use AND to separate the low (starting) and high (ending) values. | FISCAL_YEAR BETWEEN 2000 AND 2006 |
IS NULL | Specifies a search for NULL values. | CUST_EMAIL IS NULL |
IS NOT NULL | Specifies a search for values that are not NULL. | PROD_STATUS IS NOT NULL |
AND | Combines two conditions and evaluates to TRUE when both of the conditions are TRUE. | PROD_MIN_PRICE > 1000 AND COUNTRY_NAME = 'Spain' |
OR | Combines two conditions and evaluates to TRUE when either condition is TRUE. | PROD_LIST_PRICE > 50 OR PROD_CATEGORY = 'Hardware' |
NOT | Reverses the value of any Boolean expression. | NOT(COUNTRY_REGION = 'Europe' AND AMOUNT_SOLD > 1000) |
Note that you cannot use aggregating functions (such as SUM) in the query. The IN expression is also not supported.
COUNTRY_NAME = 'Spain' // Correct COUNTRY_NAME = "Spain" // Incorrect because double quotes are not allowed COUNTRY_NAME = Spain // Incorrect because the attribute stores string values
AMOUNT_SOLD = 500 // Correct AMOUNT_SOLD = "500" // Incorrect because the attribute stores numeric values
If you are making direct queries against the Conversation Web Service (for example, by using the soapUI tool), you may need to escape some XML characters to prevent parsing errors. For example, you should use the < escape character instead of the < (less than) character. Note that examples in this chapter will use the unescaped version for ease of reading.
If a language ID is not specified, then en (English) is the default.
Note that this Language element serves a different purpose from the Language attribute in the SearchFilter type (for record search) and the ValueSearchConfig type (for value search).
The following example shows where in the request you would specify the Language element for EQL parsing error messages.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Header/> <soapenv:Body> <Request xmlns="http://www.endeca.com/MDEX/conversation/2/0"> <Language>fr</Language> <State> <DataSourceFilterString> COUNTRY_NAME = 'France' </DataSourceFilterString> <SelectionFilterString> AMOUNT_SOLD > 1000 </SelectionFilterString> </State> <ContentElementConfig xsi:type="RecordListConfig" HandlerFunction="RecordListHandler" HandlerNamespace="http://www.endeca.com/MDEX/conversation/handlers/2010" Id="RecordList" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> </ContentElementConfig> </Request> </soapenv:Body> </soapenv:Envelope>
In this example, the DataSourceFilterString first filters out all records that do not have a value of "France" in their COUNTRY_NAME assignment. It then returns all records that have an AMOUNT_SOLD assignment with a value greater than 1000.