[SOLVED]create filename string from example value
Hi
cannot figure out how to make a file name (in my case for a csv write operator) from a particular attributes value in a particular example.
I tired macro such as Macroname=Attribname and than filename %{Macroname} but it doesnt work. It just names the file Attribname and not its particular Value.
(for selecting a single example I use loop so this is sorted out).
thanks for any help
cannot figure out how to make a file name (in my case for a csv write operator) from a particular attributes value in a particular example.
I tired macro such as Macroname=Attribname and than filename %{Macroname} but it doesnt work. It just names the file Attribname and not its particular Value.
(for selecting a single example I use loop so this is sorted out).
thanks for any help
Tagged:
0
Answers
-
Hi,
you can try something like this:<?xml version="1.0" encoding="UTF-8" standalone="no"?>
Best,
<process version="5.2.008">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="5.2.008" expanded="true" name="Process">
<process expanded="true" height="235" width="480">
<operator activated="true" class="retrieve" compatibility="5.2.008" expanded="true" height="60" name="Retrieve" width="90" x="86" y="71">
<parameter key="repository_entry" value="//Samples/data/Iris"/>
</operator>
<operator activated="true" class="extract_macro" compatibility="5.2.008" expanded="true" height="60" name="Extract Macro" width="90" x="246" y="75">
<parameter key="macro" value="fileName"/>
<parameter key="macro_type" value="data_value"/>
<parameter key="attribute_name" value="a1"/>
<parameter key="example_index" value="1"/>
</operator>
<operator activated="true" class="write_csv" compatibility="5.2.008" expanded="true" height="76" name="Write CSV" width="90" x="380" y="75">
<parameter key="csv_file" value="C:\%{fileName}"/>
</operator>
<connect from_op="Retrieve" from_port="output" to_op="Extract Macro" to_port="example set"/>
<connect from_op="Extract Macro" from_port="example set" to_op="Write CSV" to_port="input"/>
<connect from_op="Write CSV" from_port="through" 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>
Nils0 -
thx NielsNils wrote:
Hi,
you can try something like this:<?xml version="1.0" encoding="UTF-8" standalone="no"?>
Best,
<process version="5.2.008">
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="5.2.008" expanded="true" name="Process">
<process expanded="true" height="235" width="480">
<operator activated="true" class="retrieve" compatibility="5.2.008" expanded="true" height="60" name="Retrieve" width="90" x="86" y="71">
<parameter key="repository_entry" value="//Samples/data/Iris"/>
</operator>
<operator activated="true" class="extract_macro" compatibility="5.2.008" expanded="true" height="60" name="Extract Macro" width="90" x="246" y="75">
<parameter key="macro" value="fileName"/>
<parameter key="macro_type" value="data_value"/>
<parameter key="attribute_name" value="a1"/>
<parameter key="example_index" value="1"/>
</operator>
<operator activated="true" class="write_csv" compatibility="5.2.008" expanded="true" height="76" name="Write CSV" width="90" x="380" y="75">
<parameter key="csv_file" value="C:\%{fileName}"/>
</operator>
<connect from_op="Retrieve" from_port="output" to_op="Extract Macro" to_port="example set"/>
<connect from_op="Extract Macro" from_port="example set" to_op="Write CSV" to_port="input"/>
<connect from_op="Write CSV" from_port="through" 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>
Nils
it works.
Regarding your mention of writing a documentation for the operators in another thread I hope you add a detailed chapter on Macros0