Options

what is the right format for branch macro defined value ?

kaymankayman Member Posts: 662 Unicorn
edited November 2018 in Help
Hi,

I'm trying to use a branch based on a macro value, but it always takes the wrong path (not matched) and no errors are thrown. What is the correct format to enter a macro value?

I've tried all of the following :

<operator activated="true" class="branch" compatibility="6.4.000" expanded="true" height="76" name="Branch" width="90" x="179" y="30">
<parameter key="condition_type" value="macro_defined"/>

use variations :

<parameter key="condition_value" value="%{lang}=&quot;en&quot;"/>
<parameter key="condition_value" value="%{lang}==&quot;en&quot;"/>
<parameter key="condition_value" value="%{lang}=en"/>
<parameter key="condition_value" value="%{lang}==en"/>
<parameter key="condition_value" value="lang=&quot;en&quot;"/>
<parameter key="condition_value" value="lang=en"/>

etc. but none of them seemed to guide me through the right node.

Just to ensure I already have the format ok, what is the correct way to add macro lang should equal 'en' ?
Tagged:

Answers

  • Options
    Marco_BoeckMarco_Boeck Administrator, Moderator, Employee, Member, University Professor Posts: 1,996 RM Engineering
    Hi,

    macro_defined simply checks whether the macro exists. What you want is actually an expression. See the example process below:

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="7.2.000-SNAPSHOT">
     <context>
       <input/>
       <output/>
       <macros>
         <macro>
           <key>lang</key>
           <value>en</value>
         </macro>
       </macros>
     </context>
     <operator activated="true" class="process" compatibility="7.2.000-SNAPSHOT" expanded="true" name="Process">
       <process expanded="true">
         <operator activated="true" class="retrieve" compatibility="7.2.000-SNAPSHOT" expanded="true" height="68" name="Retrieve Deals" width="90" x="45" y="34">
           <parameter key="repository_entry" value="//Samples/data/Deals"/>
         </operator>
         <operator activated="true" class="set_macro" compatibility="7.2.000-SNAPSHOT" expanded="true" height="82" name="Set Macro" width="90" x="179" y="34">
           <parameter key="macro" value="lang"/>
           <parameter key="value" value="en"/>
         </operator>
         <operator activated="true" class="branch" compatibility="7.2.000-SNAPSHOT" expanded="true" height="103" name="Branch" width="90" x="313" y="34">
           <parameter key="condition_type" value="expression"/>
           <parameter key="expression" value="equals(%{lang}, &quot;en&quot;)"/>
           <process expanded="true">
             <connect from_port="input 1" to_port="input 1"/>
             <portSpacing port="source_condition" spacing="0"/>
             <portSpacing port="source_input 1" spacing="0"/>
             <portSpacing port="source_input 2" spacing="0"/>
             <portSpacing port="sink_input 1" spacing="0"/>
             <portSpacing port="sink_input 2" spacing="0"/>
           </process>
           <process expanded="true">
             <operator activated="true" class="retrieve" compatibility="7.2.000-SNAPSHOT" expanded="true" height="68" name="Retrieve Golf" width="90" x="45" y="34">
               <parameter key="repository_entry" value="//Samples/data/Golf"/>
             </operator>
             <connect from_op="Retrieve Golf" from_port="output" to_port="input 1"/>
             <portSpacing port="source_condition" spacing="0"/>
             <portSpacing port="source_input 1" spacing="0"/>
             <portSpacing port="source_input 2" spacing="0"/>
             <portSpacing port="sink_input 1" spacing="0"/>
             <portSpacing port="sink_input 2" spacing="0"/>
           </process>
         </operator>
         <connect from_op="Retrieve Deals" from_port="output" to_op="Set Macro" to_port="through 1"/>
         <connect from_op="Set Macro" from_port="through 1" to_op="Branch" to_port="input 1"/>
         <connect from_op="Branch" from_port="input 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,
    Marco
Sign In or Register to comment.