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

can i increment date

gritsaygritsay Member, University Professor Posts: 12 University Professor
edited November 2018 in Help
Hi everybody! i have a macro with date in my process. How i can increment macro in 1 day? For example i have a date = 10.01.2013. i need date+1 = 11.01.2013 how i can do it?

Alex.

Answers

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

    you can use the Generate Macro operator for that. Have a look at the following example process.

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="6.0.009">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="6.0.009" expanded="true" name="Process">
        <process expanded="true">
          <operator activated="true" class="retrieve" compatibility="6.0.009" expanded="true" height="60" name="Retrieve Iris" width="90" x="45" y="30">
            <parameter key="repository_entry" value="//Samples/data/Iris"/>
          </operator>
          <operator activated="true" class="set_macro" compatibility="6.0.009" expanded="true" height="76" name="Set Macro" width="90" x="179" y="30">
            <parameter key="macro" value="date"/>
            <parameter key="value" value="22.07.2014"/>
          </operator>
          <operator activated="true" class="generate_macro" compatibility="6.0.009" expanded="true" height="76" name="Generate Macro" width="90" x="313" y="30">
            <list key="function_descriptions">
              <parameter key="date" value="date_add(date_parse_custom(&quot;%{date}&quot;, &quot;dd.MM.yyyy&quot;, &quot;en&quot;), 1, DATE_UNIT_DAY)"/>
            </list>
          </operator>
          <operator activated="true" class="print_to_console" compatibility="6.0.009" expanded="true" height="76" name="Print to Console" width="90" x="447" y="30">
            <parameter key="log_value" value="%{date}"/>
          </operator>
          <connect from_op="Retrieve Iris" from_port="output" to_op="Set Macro" to_port="through 1"/>
          <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>
    Regards,
    Marco
  • ravishvkravishvk Member Posts: 2 Contributor I
    This macro is not working in Rapidminer 9.3.0. Getting expression evaluation error. Invalid_argument.date.
  • ravishvkravishvk Member Posts: 2 Contributor I
    Looks like by removing double quote from %{date} 
    as mentioned here, it's working as expected for Rapidminer version 9.3.

    date_add(date_parse_custom(%{date}, "dd.MM.yyyy", "en"), 1, DATE_UNIT_DAY)
Sign In or Register to comment.