Pages: [1]
  Print  
Author Topic: Looking up a macro whose name is in another macro  (Read 252 times)
tennenrishin
Full Member
***
Posts: 177


WWW
« on: February 18, 2014, 03:59:50 PM »

Hi RM community,

I am trying to save a given list of macros that are defined at some point in a process. The list is rather long, and I would like to set the process up in such a way that the list (of names of macros to save) appears in only one place in the XML. I thought this (followed by a Write CSV) would work:

Code:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.3.015">
  <context>
    <input/>
    <output/>
    <macros>
      <macro>
        <key>macro1</key>
        <value>a</value>
      </macro>
      <macro>
        <key>macro2</key>
        <value>3</value>
      </macro>
      <macro>
        <key>macro3</key>
        <value>hello</value>
      </macro>
    </macros>
  </context>
  <operator activated="true" class="process" compatibility="5.3.015" expanded="true" name="Process">
    <process expanded="true">
      <operator activated="true" class="subprocess" compatibility="5.3.015" expanded="true" height="94" name="macros.csv" width="90" x="179" y="120">
        <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 (10)" width="90" x="45" y="75">
            <list key="attribute_values">
              <parameter key="name" value="&quot;&quot;"/>
              <parameter key="value" value="&quot;&quot;"/>
            </list>
            <list key="set_additional_roles"/>
          </operator>
          <operator activated="true" class="filter_examples" compatibility="5.3.015" expanded="true" height="76" name="/ all" width="90" x="179" y="75">
            <parameter key="invert_filter" value="true"/>
          </operator>
          <operator activated="true" class="remember" compatibility="5.3.015" expanded="true" height="60" name="Remember (14)" width="90" x="313" y="75">
            <parameter key="name" value="data"/>
            <parameter key="io_object" value="ExampleSet"/>
          </operator>
          <operator activated="true" class="loop_parameters" compatibility="5.3.015" expanded="true" height="60" name="Loop Parameters (2)" width="90" x="447" y="75">
            <list key="parameters">
              <parameter key="macro_name.value" value="macro1,macro2,macro3"/>
            </list>
            <process expanded="true">
              <operator activated="true" class="recall" compatibility="5.3.015" expanded="true" height="60" name="Recall (14)" width="90" x="45" y="30">
                <parameter key="name" value="data"/>
                <parameter key="io_object" value="ExampleSet"/>
              </operator>
              <operator activated="true" class="set_macro" compatibility="5.3.015" expanded="true" height="60" name="macro_name" width="90" x="179" y="120">
                <parameter key="macro" value="macro_name"/>
                <parameter key="value" value="macro3"/>
              </operator>
              <operator activated="true" class="generate_data_user_specification" compatibility="5.3.015" expanded="true" height="60" name="Generate Data by User Specification (7)" width="90" x="313" y="120">
                <list key="attribute_values">
                  <parameter key="name" value="&quot;%{macro_name}&quot;"/>
                  <parameter key="value" value="macro(&quot;%{macro_name}&quot;)"/>
                </list>
                <list key="set_additional_roles"/>
              </operator>
              <operator activated="true" class="append" compatibility="5.3.015" expanded="true" height="94" name="Append (2)" width="90" x="447" y="75"/>
              <operator activated="true" class="remember" compatibility="5.3.015" expanded="true" height="60" name="Remember (15)" width="90" x="581" y="30">
                <parameter key="name" value="data"/>
                <parameter key="io_object" value="ExampleSet"/>
              </operator>
              <connect from_op="Recall (14)" from_port="result" to_op="Append (2)" to_port="example set 1"/>
              <connect from_op="Generate Data by User Specification (7)" from_port="output" to_op="Append (2)" to_port="example set 2"/>
              <connect from_op="Append (2)" from_port="merged set" to_op="Remember (15)" to_port="store"/>
              <portSpacing port="source_input 1" spacing="0"/>
              <portSpacing port="sink_performance" spacing="0"/>
              <portSpacing port="sink_result 1" spacing="0"/>
            </process>
          </operator>
          <operator activated="true" class="recall" compatibility="5.3.015" expanded="true" height="60" name="Recall (2)" width="90" x="581" y="75">
            <parameter key="name" value="data"/>
            <parameter key="io_object" value="ExampleSet"/>
          </operator>
          <connect from_op="Generate Data by User Specification (10)" from_port="output" to_op="/ all" to_port="example set input"/>
          <connect from_op="/ all" from_port="example set output" to_op="Remember (14)" to_port="store"/>
          <connect from_op="Recall (2)" from_port="result" to_port="out 1"/>
          <portSpacing port="source_in 1" spacing="0"/>
          <portSpacing port="sink_out 1" spacing="0"/>
          <portSpacing port="sink_out 2" spacing="0"/>
        </process>
      </operator>
      <connect from_op="macros.csv" from_port="out 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>

but it doesn't, for some reason. Maybe I misunderstood what the "macro" function does. Could anyone point me in the right direction?

Thanks in advance,
Isak
« Last Edit: February 18, 2014, 04:03:30 PM by tennenrishin » Logged
tennenrishin
Full Member
***
Posts: 177


WWW
« Reply #1 on: February 18, 2014, 10:27:22 PM »

Found a workaround: "macro()" function seems to work as expected in the Generate Macro operator.
Logged
Pages: [1]
  Print  
 
Jump to: