query_without_connection.xaction 4.95 KB
Newer Older
Thitichaipun Wutthisak committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
<?xml version="1.0" encoding="UTF-8"?>
<action-sequence> 
  <name>query1.xaction</name>
  <title>%title</title>
  <version>1</version>
  <logging-level>debug</logging-level>
  <documentation> 
    <author>James Dixon</author>  
    <help>just testing...</help>  
    <result-type>report</result-type>  
    <description>%description</description>  
    <icon>slicedice.png</icon> 
  </documentation>

  <inputs> 
    <region type="string-list"> 
      <default-value/>  
      <sources> 
        <request>region</request> 
      </sources> 
    </region>  
    <department type="string-list"> 
      <default-value/>  
      <sources> 
        <request>department</request> 
      </sources> 
    </department>  
    <position type="string-list"> 
      <default-value/>  
      <sources> 
        <request>position</request> 
      </sources> 
    </position>  
    <mdx type="string"> 
      <default-value/>  
      <sources> 
        <request>MDX</request> 
      </sources> 
    </mdx>  
    <mode type="string"> 
      <default-value/>  
      <sources> 
        <request>mode</request> 
      </sources> 
    </mode> 
  </inputs>

  <outputs> 
    <model type="string"/>  
    <mdx type="string"/>  
    <options type="list"/>  
    <title type="string"/>  
    <url type="string"> 
      <destinations> 
        <response>redirect</response> 
      </destinations> 
    </url> 
  </outputs>

  <resources/>
  
  <actions> 
    <action-definition> 
      <component-name>JavascriptRule</component-name>
      <action-type>JavaScript</action-type>
      <action-inputs> 
        <region type="string"/>  
        <department type="string"/>  
        <position type="string"/> 
      </action-inputs>
      <action-outputs> 
        <regionSelects type="string"/>  
        <departmentSelects type="string"/>  
        <positionSelects type="string"/> 
      </action-outputs>
      <component-definition> 
        <script><![CDATA[function getSelects( baseStr, values ) {
    rtnStr = baseStr;
    if ( values == null ) {
        // Do nothing and the baseStr will be returned
    }
    else if ( typeof( values ) == "string" ) {
        rtnStr += values;
    }
    else {
        rtnStr = baseStr;
        if ( (values != null) && (values.length >= 1) ) {
            rtnStr += values[0];
            for ( i = 1; i < values.length; ++i ) {
                rtnStr += ", " + baseStr + values[i];
            }
        }
    }
java.lang.System.out.println( rtnStr );
    return( rtnStr );
}

regionSelects = getSelects( "[Region].[All Regions]", region );
departmentSelects = getSelects( "[Department].[All Departments]", department );
positionSelects = getSelects( "[Positions].[All Positions]", position );]]></script> 
      </component-definition> 
    </action-definition>
  
    <action-definition> 
      <component-name>PivotViewComponent</component-name>
      <action-inputs> 
        <mode type="string"/>  
        <regionSelects type="string"/>  
        <departmentSelects type="string"/>  
        <positionSelects type="string"/> 
      </action-inputs>
      <action-outputs> 
        <model type="string"/>  
        <mdx type="string"/>  
        <options type="list"/>  
        <title type="string"/>  
        <url type="string"/> 
      </action-outputs>
      <component-definition> 
        <title>Drill Down to Pivot Table</title>  
        <viewer>Pivot</viewer>  
        <model>samples/analysis/SampleData.mondrian.xml</model>  
        <!--  connection>jdbc/SampleData</connection -->  
        <jndi>SampleData</jndi>  
        <!--  query>default</query -->  
        <options> 
          <personal/>  
          <cube-nav/>  
          <mdx-edit/>  
          <sort-conf/>  
          <spacer/>  
          <level-style/>  
          <hide-spans/>  
          <properties/>  
          <non-empty/>  
          <swap-axes/>  
          <spacer/>  
          <drill-member/>  
          <drill-position/>  
          <drill-replace/>  
          <drill-thru/>  
          <spacer/>  
          <chart/>  
          <chart-conf/>  
          <spacer/>  
          <print-conf/>  
          <print-pdf/>  
          <spacer/>  
          <excel/> 
        </options>  
        <query><![CDATA[with member [Measures].[Variance Percent] as '([Measures].[Variance] / [Measures].[Budget])', 
     format_string = IIf(((([Measures].[Variance] / [Measures].[Budget]) * 100.0) > 2.0), "|#.00%|style='green'", 
                               IIf(((([Measures].[Variance] / [Measures].[Budget]) * 100.0) < 0.0), "|#.00%|style='red'", "#.00%"))

select NON EMPTY {[Measures].[Actual], [Measures].[Budget], [Measures].[Variance], [Measures].[Variance Percent]} ON COLUMNS,
           NON EMPTY Crossjoin({ {regionSelects} }, 
                               Crossjoin({ {departmentSelects} }, { {positionSelects} } ) ) ON ROWS

from [Quadrant Analysis]]]></query> 
      </component-definition>  
      <action-name>Pivot View</action-name>  
      <logging-level>DEBUG</logging-level> 
    </action-definition>
 
  </actions> 
</action-sequence>