How can i do to change integer values in more than 1 attribute?

cdaponte
cdaponte New Altair Community Member
edited November 2024 in Community Q&A
I have an example set with 5 attributes that are number in a reduce scale of thounsands, i want to multiply all the values for 1000. For example: the value is 20, but i want to do 20*1000 and i want to do that in all the values of 5 attributes. Can you help me? Thanks in advanced
Tagged:

Best Answer

  • IngoRM
    IngoRM New Altair Community Member
    Answer ✓
    And you can place the Generate Attributes inside of a Loop Attributes if you want to automate the multiplication for all columns (I guess with 5 you can also use 5 Generate Attributes, but, you know, it's cooler with a loop B) )

Answers

  • lionelderkrikor
    lionelderkrikor New Altair Community Member
    Hi @cdaponte

    If I good understand, you will need of Generate Attributes operator for this task.
    The name of the generated attribute has to be strictly the same that the name of the original attribute.

    Hope this helps,

    Regards,

    Lionel
  • cdaponte
    cdaponte New Altair Community Member
    Yes, i considered that option, but it i have 5 attributes that require this process, so i have to use 5 different generatte attributes, or there is a way to integrate all with one operator?
  • varunm1
    varunm1 New Altair Community Member
    Hello @cdaponte

    You don't need five generate attribute operators, you can create all of them in one. Here is the XML code for you to check.

    <?xml version="1.0" encoding="UTF-8"?><process version="9.4.001">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="6.0.002" expanded="true" name="Process" origin="GENERATED_TUTORIAL">
        <parameter key="logverbosity" value="init"/>
        <parameter key="random_seed" value="2001"/>
        <parameter key="send_mail" value="never"/>
        <parameter key="notification_email" value=""/>
        <parameter key="process_duration_for_mail" value="30"/>
        <parameter key="encoding" value="SYSTEM"/>
        <process expanded="true">
          <operator activated="true" class="retrieve" compatibility="9.4.001" expanded="true" height="68" name="Retrieve Polynomial" width="90" x="112" y="85">
            <parameter key="repository_entry" value="//Samples/data/Polynomial"/>
          </operator>
          <operator activated="true" breakpoints="before,after" class="generate_attributes" compatibility="9.4.001" expanded="true" height="82" name="Generate Attributes" width="90" x="313" y="85">
            <list key="function_descriptions">
              <parameter key="a1" value="a1*1000"/>
              <parameter key="a2" value="a2*1000"/>
              <parameter key="a3" value="a3*1000"/>
              <parameter key="a4" value="a4*1000"/>
              <parameter key="a5" value="a5*1000"/>
            </list>
            <parameter key="keep_all" value="false"/>
          </operator>
          <connect from_op="Retrieve Polynomial" 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>
    
    Hope this helps

  • IngoRM
    IngoRM New Altair Community Member
    Answer ✓
    And you can place the Generate Attributes inside of a Loop Attributes if you want to automate the multiplication for all columns (I guess with 5 you can also use 5 Generate Attributes, but, you know, it's cooler with a loop B) )
  • cdaponte
    cdaponte New Altair Community Member
    haha yes is cooler with a loop @IngoRM
    Thanks!