The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here

How to assign number of examples as a macro value in create example set operator.

hbajpaihbajpai Member Posts: 102 Unicorn
edited March 2020 in Help
So, I have a problem statement in which total examples for create example set operators are variable and I am trying to assign them through a macro input. However, I believe the create example set operator does not take marcos as input. Please see the below snapshot of the process.

Best,
Harshit

Best Answer

Answers

  • varunm1varunm1 Member Posts: 1,207 Unicorn
    Hello @hbajpai

    I tried using set macro with a value of 100 and macro name as "name". Then I used create exampleset where I called that macro %{name} in the number of examples and it worked. Can you check your macro is returning a value (number)? You can check this by enabling macro window in View --> Show Panel --> Macros. Try to set a breakpoint before create exampleset by right-clicking on it and run it to check macro value.



    Do let us know if you need more information.
    Regards,
    Varun
    https://www.varunmandalapu.com/

    Be Safe. Follow precautions and Maintain Social Distancing

  • hbajpaihbajpai Member Posts: 102 Unicorn
    @varunm1 In the standalone cases, I have tried too and it works as you demonstrated in the above example. In my situation, the macro is returning a number, I even used eval() to ensure it.  I have attached the XML code of the mock process to demonstrate the error. 
    <?xml version="1.0" encoding="UTF-8"?><process version="9.6.000">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="9.6.000" expanded="true" name="Process">
        <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="generate_macro" compatibility="9.6.000" expanded="true" height="68" name="Generate Macro" width="90" x="581" y="136">
            <list key="function_descriptions">
              <parameter key="total_10min" value="1 - date_diff(date_parse_custom(&quot;03/22/2020 10:00:00 PM&quot;,&quot;MM/dd/yyyy hh:mm:ss aa&quot;),&#10;&#9;&#9;&#9;&#9;date_parse_custom(&quot;01/22/2020 10:00:00 PM&quot;,&quot;MM/dd/yyyy hh:mm:ss aa&quot;))/600000"/>
              <parameter key="total_10min_1" value="eval(%{total_10min})"/>
            </list>
          </operator>
          <operator activated="true" class="utility:create_exampleset" compatibility="9.6.000" expanded="true" height="68" name="Create ExampleSet" width="90" x="849" y="34">
            <parameter key="generator_type" value="date series"/>
            <parameter key="number_of_examples" value="%{total_10min_1}"/>
            <parameter key="use_stepsize" value="true"/>
            <list key="function_descriptions"/>
            <parameter key="add_id_attribute" value="false"/>
            <list key="numeric_series_configuration"/>
            <list key="date_series_configuration"/>
            <list key="date_series_configuration (interval)">
              <parameter key="TimeStamp" value="2010-11-12 18:10:00 PM.10.minute"/>
            </list>
            <parameter key="date_format" value="yyyy-MM-dd HH:mm:ss"/>
            <parameter key="time_zone" value="SYSTEM"/>
            <parameter key="column_separator" value=","/>
            <parameter key="parse_all_as_nominal" value="false"/>
            <parameter key="decimal_point_character" value="."/>
            <parameter key="trim_attribute_names" value="true"/>
          </operator>
          <connect from_op="Create ExampleSet" from_port="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>
    
    

    Best,
    Harshit
Sign In or Register to comment.