Between range filters

Use the EQL BETWEEN operator to construct between range filter queries.

A between range filter query returns records with a standard or managed attribute value that falls between a lower bound and an upper bound.

BETWEEN operator syntax

The syntax for BETWEEN is:
attribute BETWEEN lowerBound AND upperBound

where attribute is the attribute whose value will be tested.

BETWEEN is inclusive, which means that it returns TRUE if the value of attribute is greater than or equal to the value of lowerBound and less than or equal to the value of upperBound.

Supported data types for attribute and the range values are integer, double, dateTime, duration, time, string, and Boolean. With one exception, attribute must be of the same data type as lowerBound and upperBound. The exception is that you can use a mix of integer and double, because the integer is promoted to a double.

Between single-assign examples

This first example shows a between range filter query for a single-assign attribute (UNIT_PRICE) of type double:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Header/>
   <soapenv:Body>
      <Request xmlns="http://www.endeca.com/MDEX/conversation/3/0">
        <Language>es</Language>
        <State>
          <DataSourceFilter Id="DataFlt">
             <filterString>COUNTRY_NAME = 'Spain'</filterString>
          </DataSourceFilter>
          <SelectionFilter Id="BtwFlt">
             <filterString>UNIT_PRICE BETWEEN 500 AND 1000</filterString>
          </SelectionFilter>
        </State>
        <RecordListConfig Id="Recs" MaxPages="20">
           <RecordsPerPage>5</RecordsPerPage>
        </RecordListConfig>
      </Request>
    </soapenv:Body>
</soapenv:Envelope>

This example first limits the data source records to those that have a COUNTRY_NAME assignment of 'Spain' and then returns all records whose UNIT_PRICE value is between 500 and 1000. Because both bound elements are inclusive, the returned records include those with UNIT_PRICE values of 500 and 1000.

This second example shows a between range filter query for a single-assign attribute (COUNTRY_NAME) of type string:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Header/>
   <soapenv:Body>
      <Request xmlns="http://www.endeca.com/MDEX/conversation/3/0">
        <State>
          <DataSourceFilter Id="DataFlt">
             <filterString>AMOUNT_SOLD > 100</filterString>
          </DataSourceFilter>
          <SelectionFilter Id="BtwFlt">
             <filterString>COUNTRY_NAME BETWEEN 'Argentina' AND 'Japan'</filterString>
          </SelectionFilter>
        </State>
        <RecordListConfig Id="Recs" MaxPages="20">
           <RecordsPerPage>5</RecordsPerPage>
        </RecordListConfig>
      </Request>
    </soapenv:Body>
</soapenv:Envelope>

This example first limits the data source records to those that have an AMOUNT_SOLD assignment of 100 or greater and then returns all records whose COUNTRY_NAME assignment value is a country name between Argentina and Japan (such as Canada and Italy).

Between multi-assign example

This example shows a between range filter query for a single-assign attribute (Quantity) of type integer:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Header/>
   <soapenv:Body>
      <Request xmlns="http://www.endeca.com/MDEX/conversation/3/0">
         <Language>en</Language>
         <State>
            <SelectionFilter>
               <filterString>SOME i IN Quantity SATISFIES (i BETWEEN 10 AND 30)</filterString>
            </SelectionFilter>
         </State>
         <RecordListConfig Id="recs">
            <Column>Quantity</Column>
         </RecordListConfig>
      </Request>
   </soapenv:Body>
</soapenv:Envelope>

The example would return all records whose Quantity assignment is between 10 and 30.