"[SOLVED] empty-string macro in Execute Process operator"

tennenrishin
tennenrishin New Altair Community Member
edited November 5 in Community Q&A
Hi all

Is there a way to denote an empty string in the "macro value" field of the "macros" parameter of the "Execute Process" operator.

If I leave it blank, the entire macro seems to be discarded automatically.

Thanks in advance
Isak

Answers

  • MariusHelf
    MariusHelf New Altair Community Member
    Hi Isaac,

    no, that's currently not possible. If you really need it you could use the Generate Macro with the replace() function. I admit it's not the most elegant thing, but it works. Please see the attached process.

    Best, Marius
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.2.006">
     <context>
       <input/>
       <output/>
       <macros/>
     </context>
     <operator activated="true" class="process" compatibility="5.2.006" expanded="true" name="Process">
       <process expanded="true" height="280" width="614">
         <operator activated="true" class="set_macro" compatibility="5.2.006" expanded="true" height="76" name="Set Macro" width="90" x="179" y="30">
           <parameter key="macro" value="x"/>
           <parameter key="value" value="a"/>
         </operator>
         <operator activated="true" class="generate_macro" compatibility="5.2.006" expanded="true" height="76" name="Generate Macro" width="90" x="313" y="30">
           <list key="function_descriptions">
             <parameter key="x" value="replace(&quot;%{x}&quot;, &quot;a&quot;, &quot;&quot;)"/>
           </list>
         </operator>
         <operator activated="true" class="print_to_console" compatibility="5.2.006" expanded="true" height="76" name="Print to Console" width="90" x="447" y="30">
           <parameter key="log_value" value="x: &quot;%{x}&quot;"/>
         </operator>
         <connect from_op="Set Macro" from_port="through 1" to_op="Generate Macro" to_port="through 1"/>
         <connect from_op="Generate Macro" from_port="through 1" to_op="Print to Console" to_port="through 1"/>
         <connect from_op="Print to Console" 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>
    Oh, I just saw that you need it for Execute Process. That's not possible, however you could define a string representing "empty" and replace it with empty in the executed process with the above operators.