Wirte file with date in filename

Nicson
Nicson New Altair Community Member
edited November 2024 in Community Q&A

Hi

is there a possibility to automatically integrate the current date into the file name when saving files (e. g. write excel)?

As an example, the file should be called "filename_yymmdd.xls".

 

Best regards

Best Answer

  • David_A
    David_A New Altair Community Member
    Answer ✓

    Hi Nicson,

     

    you can integrate the name by using a macro.

    By default, each process has a macro called process_start, which has the following format "2018_03_13-AM_11_12_01", which might be a bit long.

    With the Generate Macro, you can use String manipulation to shorten it to the first 10 characters, if you are only interested in the data. Alternatively you can use the data_now() function and extract the parts of the date you need.

     
    To add the macro to you just add it to your desired file name with the %{macro_name}  syntax. In case this could look like that:

    "filename_%{date_macro}.xls"

     

    There is also a very good knowledge base about macros available if you want to learn more:

    https://community.rapidminer.com/t5/RapidMiner-Studio-Knowledge-Base/How-to-Use-Macros/ta-p/32966

     

    Best,
    David

Answers

  • David_A
    David_A New Altair Community Member
    Answer ✓

    Hi Nicson,

     

    you can integrate the name by using a macro.

    By default, each process has a macro called process_start, which has the following format "2018_03_13-AM_11_12_01", which might be a bit long.

    With the Generate Macro, you can use String manipulation to shorten it to the first 10 characters, if you are only interested in the data. Alternatively you can use the data_now() function and extract the parts of the date you need.

     
    To add the macro to you just add it to your desired file name with the %{macro_name}  syntax. In case this could look like that:

    "filename_%{date_macro}.xls"

     

    There is also a very good knowledge base about macros available if you want to learn more:

    https://community.rapidminer.com/t5/RapidMiner-Studio-Knowledge-Base/How-to-Use-Macros/ta-p/32966

     

    Best,
    David