🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

[SOLVED] How to extract operator parameter into macro

User: "tennenrishin"
New Altair Community Member
Updated by Jocelyn
Is there any way to get a given parameter of a given operator into a macro? For example, if my process has a Retrieve operator, I would like to get Retrieve.repository_entry into a macro.

(You may wonder why I don't rather put the macro into the parameter, but that way the meta data doesn't come out of Retrieve at design-time. Plus I don't get the repository browsing dialog box when setting the macro.)

Find more posts tagged with

Sort by:
1 - 2 of 21
    User: "Andrew2"
    New Altair Community Member
    Hello

    You can use the Log operator to determine and log the value of another operator's parameter. From there convert the single log entry to an example set containing 1 example using the Log to Data operator. Then use the Extract Macro operator to get the value of the lone example into a macro.

    Here's an example (which also re-reports the macro to prove it is being set correctly)
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <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="251" width="882">
          <operator activated="true" class="retrieve" compatibility="5.2.008" expanded="true" height="60" name="Retrieve" width="90" x="112" y="120">
            <parameter key="repository_entry" value="//Samples/data/Iris"/>
          </operator>
          <operator activated="true" class="log" compatibility="5.2.008" expanded="true" height="76" name="Log" width="90" x="246" y="120">
            <list key="log">
              <parameter key="repositoryEntry" value="operator.Retrieve.parameter.repository_entry"/>
            </list>
          </operator>
          <operator activated="true" class="log_to_data" compatibility="5.2.008" expanded="true" height="94" name="Log to Data" width="90" x="380" y="120"/>
          <operator activated="true" class="extract_macro" compatibility="5.2.008" expanded="true" height="60" name="Extract Macro" width="90" x="514" y="120">
            <parameter key="macro" value="reMacro"/>
            <parameter key="macro_type" value="data_value"/>
            <parameter key="attribute_name" value="repositoryEntry"/>
            <parameter key="example_index" value="1"/>
          </operator>
          <operator activated="true" class="provide_macro_as_log_value" compatibility="5.2.008" expanded="true" height="76" name="Provide Macro as Log Value" width="90" x="648" y="120">
            <parameter key="macro_name" value="reMacro"/>
          </operator>
          <operator activated="true" class="log" compatibility="5.2.008" expanded="true" height="76" name="Log (2)" width="90" x="782" y="120">
            <list key="log">
              <parameter key="reMacro" value="operator.Provide Macro as Log Value.value.macro_value"/>
            </list>
          </operator>
          <connect from_op="Retrieve" from_port="output" to_op="Log" to_port="through 1"/>
          <connect from_op="Log" from_port="through 1" to_op="Log to Data" to_port="through 1"/>
          <connect from_op="Log to Data" from_port="exampleSet" to_op="Extract Macro" to_port="example set"/>
          <connect from_op="Extract Macro" from_port="example set" to_op="Provide Macro as Log Value" to_port="through 1"/>
          <connect from_op="Provide Macro as Log Value" from_port="through 1" to_op="Log (2)" to_port="through 1"/>
          <connect from_op="Log (2)" 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>
    regards

    Andrew
    User: "tennenrishin"
    New Altair Community Member
    OP
    Thanks Andrew!