<?xml version="1.0" encoding="UTF-8"?>
<action-sequence> 
  <title>03. TOP TEN CUSTOMERS' PRODUCT LINE MIX</title>
  <version>1</version>
  <documentation> 
    <author>Kurtis Cruzada</author>  
    <description>Top Ten Customers based on Sales and breakdown of Product Lines</description>  
    <icon>PentahoReporting.png</icon>  
    <help>Choose Report Output Format.</help>  
    <result-type>report</result-type> 
  </documentation>

  <inputs> 
    <outputType type="string"> 
      <sources> 
        <request>outputType</request>  
        <request>type</request> 
      </sources>  
      <default-value><![CDATA[pdf]]></default-value> 
    </outputType>  
    <outputTypeList type="property-map-list"> 
      <sources> 
        <runtime>outputTypeList</runtime> 
      </sources>  
      <default-value type="property-map-list"> 
        <property-map> 
          <entry key="report-output-desc">PDF</entry>  
          <entry key="report-output-type-id">pdf</entry> 
        </property-map>  
        <property-map> 
          <entry key="report-output-desc">Excel</entry>  
          <entry key="report-output-type-id">xls</entry> 
        </property-map>  
        <property-map> 
          <entry key="report-output-desc">Word</entry>  
          <entry key="report-output-type-id">rtf</entry> 
        </property-map>  
        <property-map> 
          <entry key="report-output-desc">Web Page</entry>  
          <entry key="report-output-type-id">html</entry> 
        </property-map>  
        <property-map> 
          <entry key="report-output-desc">Comma Separated Value</entry>  
          <entry key="report-output-type-id">csv</entry> 
        </property-map> 
      </default-value> 
    </outputTypeList> 
  </inputs>

  <outputs/>

  <resources> 
    <report-definition> 
      <solution-file> 
        <location>Top Ten Customer Product Line Analysis.xml</location>  
        <mime-type>text/xml</mime-type> 
      </solution-file> 
    </report-definition>  
    <catalog0> 
      <solution-file> 
        <location>steelwheels.mondrian.xml</location>  
        <mime-type>text/xml</mime-type> 
      </solution-file> 
    </catalog0> 
  </resources>
  
  <actions> 
    <action-definition> 
      <component-name>SecureFilterComponent</component-name>
      <action-type>Prompt for Report Export Type</action-type>
      <action-inputs> 
        <outputTypeList type="property-map-list"/>  
        <outputType type="string"/> 
      </action-inputs>
      <component-definition> 
        <selections> 
          <outputType style="radio"> 
            <title>Choose Report Format</title>  
            <filter value-col-name="report-output-type-id" display-col-name="report-output-desc">outputTypeList</filter> 
          </outputType> 
        </selections> 
      </component-definition> 
    </action-definition>
  
    <action-definition> 
      <component-name>MDXLookupRule</component-name>
      <action-resources> 
        <catalog type="resource" mapping="catalog0"/> 
      </action-resources>
      <action-outputs> 
        <prepared_component type="mdx-connection" mapping="conn0"/> 
      </action-outputs>
      <component-definition> 
        <location><![CDATA[mondrian]]></location>  
        <jndi><![CDATA[SampleData]]></jndi> 
      </component-definition> 
    </action-definition>
  
    <action-definition> 
      <component-name>MDXLookupRule</component-name>
      <action-inputs> 
        <prepared_component type="mdx-connection" mapping="conn0"/> 
      </action-inputs>
      <action-outputs> 
        <query-results type="result-set" mapping="query_result"/> 
      </action-outputs>
      <component-definition> 
        <query><![CDATA[select NON EMPTY {[Measures].[Sales]} ON COLUMNS, NON EMPTY TopCount([Customers].[All Customers].Children, 10.0, [Measures].[Sales]) ON ROWS from [SteelWheelsSales]]]></query> 
      </component-definition> 
    </action-definition>
  
    <action-definition> 
      <component-name>SQLLookupRule</component-name>
      <action-outputs> 
        <prepared_component type="sql-query" mapping="subProductLine"/> 
      </action-outputs>
      <component-definition> 
        <jndi><![CDATA[SampleData]]></jndi>  
        <query><![CDATA[SELECT
     PRODUCTS.PRODUCTLINE,
     SUM(QUANTITYORDERED*PRICEEACH)AS TOTALPRICE
FROM
     PRODUCTS INNER JOIN ORDERDETAILS ON PRODUCTS.PRODUCTCODE = ORDERDETAILS.PRODUCTCODE
     INNER JOIN ORDERS ON ORDERDETAILS.ORDERNUMBER = ORDERS.ORDERNUMBER
     INNER JOIN CUSTOMERS ON ORDERS.CUSTOMERNUMBER = CUSTOMERS.CUSTOMERNUMBER
WHERE CUSTOMERS.CUSTOMERNAME = {PREPARELATER:Customers}
GROUP BY
     PRODUCTS.PRODUCTLINE
ORDER BY
     2  DESC
]]></query>  
        <live><![CDATA[true]]></live> 
      </component-definition> 
    </action-definition>
  
    <action-definition> 
      <component-name>JFreeReportComponent</component-name>
      <action-type>report</action-type>
      <action-inputs> 
        <output-type type="string" mapping="outputType"/>  
        <data type="result-set" mapping="query_result"/>  
        <subProductLine type="sql-query"/> 
      </action-inputs>
      <action-resources>
        <report-definition type="resource"/>
      </action-resources>
      <action-outputs/>
      <component-definition/> 
    </action-definition>
 
  </actions> 
</action-sequence>