pentaho 使用 MM-YYYY 创建存档文件夹 [英] pentaho create archive folder with MM-YYYY

查看:19
本文介绍了pentaho 使用 MM-YYYY 创建存档文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过将文件夹中的每个文件放入另一个名称如下的存档文件夹来存档文件夹中的每个文件:Archive/myfolder-06-2014"

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.

推荐答案

这个解决方案可能有点笨拙(由于需要大惊小怪),但它似乎有效.这个想法是在单独的转换中预先计算目标文件名并将其存储为系统变量(TARGET_ZIP_FILENAME):

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.

  • 获取当前时间...

  • 提供目标文件名的模式作为字符串常量...

  • 将月份和年份提取为格式化整数...

  • 替换模式中的月份(年份等效)

  • 将结果文件名设置为系统变量

主要作业将调用转换并使用系统变量作为 zip 目标文件名.

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

此外,您还必须确保设置 Create Parent folder 处于活动状态:

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

这篇关于pentaho 使用 MM-YYYY 创建存档文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆