script_rule_error4.xaction 1.46 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

<action-sequence>

	<name>script_rule_error4.xaction</name>
	<version>1</version>
	<title>Sample Javascript rule</title>
	<logging-level>debug</logging-level>
	<documentation>
		<author>Marc Batchelor</author>
		<description>Javascript rule test</description>
		<help>just testing...</help>
	</documentation>

	<inputs>
		<user-name type="string">
		  <default-value>joe</default-value>
		</user-name>
	</inputs>

	<outputs>
		<rule-result type="list"/>
	</outputs>
  <resources/>
  
  <actions>
      <action-definition>
      	<action-inputs>
			<user-name type="string"/>
      	</action-inputs>
        <action-outputs>
          	<rule-result type="list"/>
        </action-outputs>
        
        <component-name>JavascriptRule</component-name>
        <action-type>rule</action-type>
      	<component-definition>
      		<script><![CDATA[ 
			      function testDashedVariable( ) {
			      	var results = new JavaScriptResultSet();
			      	results.setColumnHeaders( 'REGION' );
			      	if( user_name == 'joe' ) {
			      		results.addRow( new Array( 'Central' ) );
			      	} 
			      	else if( use_name == 'suzy' ) {
			      		results.addRow( new Array( 'Eastern' ) );
			      		results.addRow( new Array( 'Western' ) );
			      		results.addRow( new Array( 'Southern' ) );
			      	}
			      	return results;
			      }
			    testDashedVariable( ); 
		      ]]>
		      </script>
        </component-definition>
      </action-definition>
  </actions>
</action-sequence>