script_rule4.xaction 2.04 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

<action-sequence>

	<name>script_rule4.xaction</name>
	<version>1</version>
	<title>Sample Javascript rule</title>
	<logging-level>debug</logging-level>
	<documentation>
		<author>James Dixon</author>
		<description>Javascript rule test</description>
		<help>just testing...</help>
	</documentation>

	<inputs>
	</inputs>

	<outputs>
          	<columns type="string"/>
          	<rows type="string"/>
          	<firstrow type="string"/>
          	<lastrow type="string"/>
	</outputs>
  <resources/>
  
  <actions>
      <action-definition>
        <component-name>JavascriptRule</component-name>
      	<action-inputs/>
        <action-outputs>
          	<regions type="list"/>
        </action-outputs>
        
        <action-type>rule</action-type>
      	<component-definition>
      		<script><![CDATA[ 
			      function getRegions( ) {
			      	var results = new JavaScriptResultSet();
			      	results.setColumnHeaders( 'REGION' );
		      		results.addRow( new Array( 'Eastern' ) );
		      		results.addRow( new Array( 'Western' ) );
		      		results.addRow( new Array( 'Southern' ) );
			      	return results;
			      }
			    getRegions( ); 
		      ]]>
		      </script>
        </component-definition>
      </action-definition>
      
      <action-definition>
        <component-name>JavascriptRule</component-name>
      	<action-inputs>
          	<regions type="list"/>
      	</action-inputs>
        <action-outputs>
          	<columns type="string"/>
          	<rows type="string"/>
          	<firstrow type="string"/>
          	<lastrow type="string"/>
        </action-outputs>
        
        <action-type>rule</action-type>
      	<component-definition>
      		<script><![CDATA[ 
	      		regions.addRow( new Array( 'bogus' ) );
		      	firstrow = regions.getValueAt(0,0);
		      	lastrow = regions.getValueAt(regions.getRowCount()-1,0);
		      	columns = regions.getColumnCount();
		      	rows = regions.getRowCount();
		      ]]>
		      </script>
        </component-definition>
      </action-definition>
  </actions>
</action-sequence>