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?



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

    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">
      <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 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 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)"/>
          <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}"/>
          <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"/>
  • Options
    ravishvkravishvk Member Posts: 2 Contributor I
    This macro is not working in Rapidminer 9.3.0. Getting expression evaluation error. Invalid_argument.date.
  • Options
    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.