<?xml version="1.0" encoding="UTF-8"?>
<action-sequence> 
  <name>Sales_by_Territory.xaction</name>
  <title>05. SALES BY TERRITORY</title>
  <version>1</version>
  <logging-level>ERROR</logging-level>
  <documentation> 
    <author>Kurtis Cruzada</author>  
    <description>List of Territories sorted by Sales. Select date range (Jan 2003 through May 2005). Includes chart.</description>  
    <icon>file.png|slsbyter.png</icon>  
    <help/> 
  </documentation>

  <inputs/>

  <outputs> 
    <!-- an output stream will be provided by default -->  
    <swresult> 
      <type>list</type> 
    </swresult> 
  </outputs>

  <resources> 
    <!-- use this section to identify any files that the component needs to execute the report --> 
  </resources>
  
  <actions> 
    <action-definition> 
      <component-name>SQLLookupRule</component-name>
      <action-type>SQL Query</action-type>
      <action-inputs> 
        <territory_name type="string"/>  
        <productline_name type="string"/> 
      </action-inputs>
      <action-outputs> 
        <query-result type="result-set" mapping="swresult"/> 
      </action-outputs>
      <component-definition> 
        <jndi>SampleData</jndi>  
        <query><![CDATA[SELECT OFFICES.TERRITORY, SUM(ORDERDETAILS.QUANTITYORDERED*ORDERDETAILS.PRICEEACH) SOLD_PRICE FROM ORDERS INNER JOIN ORDERDETAILS ON ORDERS.ORDERNUMBER = ORDERDETAILS.ORDERNUMBER INNER JOIN PRODUCTS ON ORDERDETAILS.PRODUCTCODE =PRODUCTS.PRODUCTCODE  INNER JOIN CUSTOMERS ON ORDERS.CUSTOMERNUMBER =CUSTOMERS.CUSTOMERNUMBER  INNER JOIN EMPLOYEES ON CUSTOMERS.SALESREPEMPLOYEENUMBER = EMPLOYEES.EMPLOYEENUMBER INNER JOIN OFFICES ON EMPLOYEES.OFFICECODE=OFFICES.OFFICECODE  GROUP BY OFFICES.TERRITORY ORDER BY 2 DESC]]></query> 
      </component-definition> 
    </action-definition>
 
  </actions> 
</action-sequence>