Example of an EQL request

A request made with the Conversation Web Service can include statements in the Endeca Query Language (EQL). To make EQL requests, add EQL statements with the LQLConfig type.

Consider the following EQL statement:
RETURN statement AS SELECT SUM(FactSales_SalesAmount)
WHERE (DimDate_FiscalYear=2008) AS Sales2008,
SUM(FactSales_SalesAmount)
WHERE (DimDate_FiscalYear=2007) AS Sales2007,
((Sales2008-Sales2007)/Sales2007 * 100) AS pctChange,
countDistinct(FactSales_SalesOrderNumber)
AS TransactionCount group
To send it to the Oracle Endeca Server, use the LQLConfig type of ContentElementConfig, including the statement inside the LQLQueryString element, as in this example:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns="http://www.endeca.com/MDEX/conversation/1/0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:typ="http://www.endeca.com/MDEX/lql_parser/types">
<soapenv:Header/>
<soapenv:Body>
 <ns:Request>
  <ns:State/>
   <ns:ContentElementConfig Id="LQLConfig" xsi:type="ns:LQLConfig"
    HandlerNamespace="http://www.endeca.com/MDEX/conversation/1/0"
    HandlerFunction="LQLHandler"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
     <ns:LQLQueryString>
      RETURN statement AS SELECT SUM(FactSales_SalesAmount)
      WHERE (DimDate_FiscalYear=2008) AS Sales2008,
      SUM(FactSales_SalesAmount) WHERE (DimDate_FiscalYear=2007) AS Sales2007,
      ((Sales2008-Sales2007)/Sales2007 * 100) AS pctChange,
      countDistinct(FactSales_SalesOrderNumber)
      AS TransactionCount 
      group
     </ns:LQLQueryString>
    </ns:ContentElementConfig>
   </ns:Request>
  </soapenv:Body>
</soapenv:Envelope>

The contents of the LQLQueryString in LQLConfig must be a valid EQL statement. For detailed information on EQL syntax, see the Oracle Endeca Server Query Language Reference.

The HandlerFunction that supports processing of the LQLConfig is LQLHandler.

Note: This example shows only one of the ways for using EQL statements in Conversation Web Service requests. Typically, requests also include State and Operators that define the navigation state. In your EQL statement, you can select from this navigation state using the From clause.
The following abbreviated response returned from the Conversation Web Service contains the calculated results of the EQL statements:
<cs:ContentElement xsi:type="cs:LQL" Id="LQLConfig" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <cs:ResultRecords NumRecords="1" Name="statement">
  <cs:DimensionHierarchy/>
   <cs:AttributeMetadata name="Sales2007" type="mdex:double"/>
   <cs:AttributeMetadata name="Sales2008" type="mdex:double"/>
   <cs:AttributeMetadata name="TransactionCount" type="mdex:long"/>
   <cs:AttributeMetadata name="pctChange" type="mdex:double"/>
      <cs:Record>
        <Sales2007 type="mdex:double">2.79216705182E7</Sales2007>
        <Sales2008 type="mdex:double">3.62404846965997E7</Sales2008>
        <TransactionCount type="mdex:long">3796</TransactionCount>
        <pctChange type="mdex:double">29.793397114178</pctChange>
     </cs:Record>
   </cs:ResultRecords>
 </cs:ContentElement>