2.1.4.4 Example match transformation

Match transformation gadgets are added to widgets.xml and are described in exactly the same way as processors (widgets) in EDQ - See Example written processor.

The only limitation is that a match transformation must have only one input and only one output.

Example 2-8 Example script-based gadget for an Upper Case transformation

The following is an example of a script-based gadget for an Upper Case transformation:

The following is an example of a script-based gadget for an Upper Case transformation:
  <!-- ************************************************************ -->  
  <!-- script for a simple uppercase transformation -->
  <!-- ************************************************************ -->  
  <widget id="customUppercase"
          class="com.datanomic.director.match.library.util.JavaScriptGadget">
    <guidata>
      <label>%custom.uppercase.gadget</label>
      <group>transformers</group>
      <icon>script</icon>
    </guidata>
    <!-- inputs -->
    <inputs>
      <input id="1" type="string">
        <guidata><label>%customer.uppercase.input</label></guidata>
      </input>
    </inputs>
    <!-- outputs -->
    <outputs cardinality="1:1">
      <output id="1" type="string" name="result">
        <guidata><label>%customer.uppercase.output</label></guidata>
      </output>
    </outputs>
<parameters>
      <parameter name="script">
<![CDATA[
function doit()
 {
   output1 = input1.toUpperCase();
 }
]]>
      </parameter>
      <parameter name="function">doit</parameter>
    </parameters>
  </widget>