pentaho create archive folder with MM-YYYY

前提是你 提交于 2019-12-11 08:18:37

问题


I would like to archive every file in a folder by putting it in another archive folder with a name like this: "Archive/myfolder-06-2014"

My problem is how to retrieve the current month and year and then how to create a folder (if it does not already exist) with these data.


回答1:


This solution may be a little awkward (due to the required fuss) but it seems to work. The idea is to precompute the target filename in a seperate transformation and store it as a system variable (TARGET_ZIP_FILENAME):

The following diagrams show the settings of selected components.

  • Get the current time...

  • Provide the pattern of the target filename as a string constant...

  • Extract the month and year as formatted integers...

  • Replace the month in the pattern (the year will work equivalently)

  • Set the resulting filename as a system variable

The main job will call the transformation and use the system variable as the zip target filename.

Also you have to make sure that the setting Create Parent folder is active:



来源:https://stackoverflow.com/questions/24283177/pentaho-create-archive-folder-with-mm-yyyy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!