Due to recent updates, all users are required to create an Altair One account to login to the RapidMiner community. Click the Register button to create your account using the same email that you have previously used to login to the RapidMiner community. This will ensure that any previously created content will be synced to your Altair One account. Once you login, you will be asked to provide a username that identifies you to other Community users. Email us at Community with questions.

Dynamic Report Names

spoortispoorti Member Posts: 24 Contributor II
edited November 2018 in Help
I have a process that uses 'Read Database' ,  'Generate Report' and 'Report' operators.
I create pdf file with plots using these operators.I use RapidAnalytics for scheduling this process.
I want to schedule this process daily or hourly.

For the sake of clarity lets say I want to generate daily reports.
I want the pdf files to be stored with the name report_<date>.pdf
If the scheduler executed this process from 10/5 to 10/10  and I checked the directory on 10/11 , I want to see following files

report_10_05_12
report_10_06_12
report_10_07_12
report_10_08_12
report_10_09_12
report_10_10_12

What is the best way to do this ?

Thanks


Tagged:

Answers

  • MariusHelfMariusHelf RapidMiner Certified Expert, Member Posts: 1,869 Unicorn
    Hi,

    inside your process you can use Generate Macros to create a macro containing the current date, and then use it as part of the filename in Generate Report. Please see the process below.
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.2.009">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="5.2.009" expanded="true" name="Process">
        <process expanded="true" height="428" width="924">
          <operator activated="true" class="generate_macro" compatibility="5.2.009" expanded="true" height="76" name="Generate Macro" width="90" x="45" y="75">
            <list key="function_descriptions">
              <parameter key="filename" value="date_str_custom(date_now(), &quot;yyyy_MM_dd&quot;)"/>
            </list>
          </operator>
          <operator activated="true" breakpoints="after" class="print_to_console" compatibility="5.2.009" expanded="true" height="76" name="Print to Console" width="90" x="179" y="75">
            <parameter key="log_value" value="Macro value: &quot;%{filename}&quot;"/>
          </operator>
          <operator activated="true" class="reporting:generate_report" compatibility="5.2.001" expanded="true" height="76" name="Generate Report" width="90" x="380" y="75">
            <parameter key="pdf_output_file" value="%{filename}"/>
          </operator>
          <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_op="Generate Report" to_port="through 1"/>
          <portSpacing port="source_input 1" spacing="0"/>
          <portSpacing port="sink_result 1" spacing="0"/>
        </process>
      </operator>
    </process>
Sign In or Register to comment.