Syntax Error - Generate Macro
I'm trying to build up a string to use as a file name but I'm having trouble getting the macro to generate correctly
My generate macro expression is
str('Var1') + "_" + str('Var2') +" _" + str('Var3') +".txt"
where Var1,2,3 are attributes from the exampleset
what I'd like to end up with is a macro value like
Team2_Results_Summer.txt
Team2_Predict_Summer.txt
Team9_Results_Spring.txt
but all I get is a Syntax error even when the function express says the "Expression is syntactically correct" and the process won't continue after the Generate Macro operator
My generate macro expression is
str('Var1') + "_" + str('Var2') +" _" + str('Var3') +".txt"
where Var1,2,3 are attributes from the exampleset
what I'd like to end up with is a macro value like
Team2_Results_Summer.txt
Team2_Predict_Summer.txt
Team9_Results_Spring.txt
but all I get is a Syntax error even when the function express says the "Expression is syntactically correct" and the process won't continue after the Generate Macro operator
Find more posts tagged with
Sort by:
1 - 8 of
81
Attached is an example process including sample data where the macro expression function isn't evaluated but is instead output directly. Can anyone help resolve this?
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.3.015">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="5.3.015" expanded="true" name="Process">
<process expanded="true">
<operator activated="true" class="generate_data_user_specification" compatibility="5.3.015" expanded="true" height="60" name="Generate Data by User Specification" width="90" x="45" y="90">
<list key="attribute_values">
<parameter key="Dept" value=""Name_and_Role""/>
<parameter key="Institution" value=""ABC""/>
<parameter key="OldKey" value=""abc_1""/>
</list>
<list key="set_additional_roles"/>
</operator>
<operator activated="true" class="replace" compatibility="5.3.015" expanded="true" height="76" name="Replace Comma" width="90" x="179" y="75">
<parameter key="attribute_filter_type" value="single"/>
<parameter key="attribute" value="Dept"/>
<parameter key="replace_what" value="','"/>
<parameter key="replace_by" value="_"/>
</operator>
<operator activated="true" class="replace" compatibility="5.3.015" expanded="true" height="76" name="Remove punctation" width="90" x="313" y="120">
<parameter key="attribute_filter_type" value="single"/>
<parameter key="attribute" value="Dept"/>
<parameter key="attributes" value="|Dept"/>
<parameter key="replace_what" value=" [-!"#$%&'()*+,./:;<=>?@\[\\\]_`{|}~]"/>
</operator>
<operator activated="true" class="replace" compatibility="5.3.015" expanded="true" height="76" name="Replace space" width="90" x="447" y="165">
<parameter key="attribute_filter_type" value="single"/>
<parameter key="attribute" value="Dept"/>
<parameter key="attributes" value="|Dept"/>
<parameter key="replace_what" value=" "/>
<parameter key="replace_by" value="_"/>
</operator>
<operator activated="true" breakpoints="before,after" class="set_macro" compatibility="5.3.015" expanded="true" height="76" name="Set Macro" width="90" x="581" y="165">
<parameter key="macro" value="macFileName"/>
<parameter key="value" value="str(Institution) + "_" + str(Dept) +" _" + str(OldKey) +".txt""/>
</operator>
<connect from_op="Generate Data by User Specification" from_port="output" to_op="Replace Comma" to_port="example set input"/>
<connect from_op="Replace Comma" from_port="example set output" to_op="Remove punctation" to_port="example set input"/>
<connect from_op="Remove punctation" from_port="example set output" to_op="Replace space" to_port="example set input"/>
<connect from_op="Replace space" from_port="example set output" to_op="Set Macro" to_port="through 1"/>
<connect from_op="Set Macro" from_port="through 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>
com.rapidminer.operator.UserError: Generation exception: 'Syntax error'
which doesn't really go a long way to helping me debug the problem.
I'm trying to create a unique filename for each entry in an exampleset so I can write a document (collection of tokens) to disk with 1 file per example set record