[SOLVED] generate nominal attributes?

kersorkersor Member Posts: 26  Maven
edited November 2018 in Help
hello

an  with the generate attributes operator to reate nominal attributes if a statement is true?

somithing like this: if(att_1<0 ,"Positive"),

I tried it and has an error.Do you know any other way?

Answers

  • earmijoearmijo Member Posts: 263   Unicorn
    You are forgetting the "else" part of the "if" command.

    Example. att6 = "Positive" if att1 > 0 Else "Negative"

    Check out the following code:
    <?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="-20" width="-50">
          <operator activated="true" class="generate_data" compatibility="5.2.006" expanded="true" height="60" name="Generate Data" width="90" x="67" y="54"/>
          <operator activated="true" class="generate_attributes" compatibility="5.2.006" expanded="true" height="76" name="Generate Attributes" width="90" x="232" y="54">
            <list key="function_descriptions">
              <parameter key="att6" value="if(att1&gt;0,&quot;Positive&quot;,&quot;Negative&quot;)"/>
            </list>
          </operator>
          <connect from_op="Generate Data" from_port="output" to_op="Generate Attributes" to_port="example set input"/>
          <connect from_op="Generate Attributes" from_port="example set output" 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>
  • kersorkersor Member Posts: 26  Maven
    Yes you are right!!!!!

    Thanks a lot!!!!!! 8)
Sign In or Register to comment.