Dear all,
I wonder why I cannot read out any text with the "execute script" operator. It's possible for values and it's possible to write text but not to read it... The following example code is supposed to simply copy the text from column "str" to "str2".
Please advice!
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="6.1.000">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="6.1.000" expanded="true" name="Process">
<process expanded="true">
<operator activated="true" class="generate_data" compatibility="6.1.000" expanded="true" height="60" name="Generate Data" width="90" x="45" y="30">
<parameter key="number_examples" value="5"/>
<parameter key="number_of_attributes" value="1"/>
</operator>
<operator activated="true" class="generate_attributes" compatibility="6.1.000" expanded="true" height="76" name="Generate Attributes" width="90" x="179" y="30">
<list key="function_descriptions">
<parameter key="str" value=""text""/>
<parameter key="str2" value=""""/>
</list>
</operator>
<operator activated="true" class="execute_script" compatibility="6.1.000" expanded="true" height="76" name="Execute Script" width="90" x="380" y="30">
<parameter key="script" value="import javax.swing.JOptionPane; ExampleSet exampleSet = input[ 0 ]; Attribute att = exampleSet.getAttributes().get( "str" ); Attribute att2 = exampleSet.getAttributes().get( "str2" ); for (Example example : exampleSet ) { String s = example.getValue( att ); example.setValue( att2, s ); } return exampleSet;"/>
</operator>
<connect from_op="Generate Data" from_port="output" to_op="Generate Attributes" to_port="example set input"/>
<connect from_op="Generate Attributes" from_port="example set output" to_op="Execute Script" to_port="input 1"/>
<connect from_op="Execute Script" from_port="output 1" to_port="result 1"/>
<portSpacing port="source_input 1" spacing="0"/>
<portSpacing port="sink_result 1" spacing="0"/>
<portSpacing port="sink_result 2" spacing="0"/>
</process>
</operator>
</process>
Kind regards
Sachs