简体   繁体   English

在Pentaho输出中评估操纵的SYSDATE

[英]Evaluate manipulated SYSDATE in Pentaho output

I want to include the specific start and end dates from a date range used within a query as outputs in an excel file separate from the main deliverable in Pentaho Kettle. 我想在查询中使用的日期范围中包含特定的开始和结束日期,作为与Pentaho Kettle中主要交付项分开的excel文件中的输出。

The date range in the query is 查询中的日期范围是

WHERE Entry_Date BETWEEN ${StartDate} AND ${EndDate}

And I've "parameterized" this in the Transformation Settings (under Parameters Tab) as StartDate = SYSDATE-45 EndDate = SYSDATE 我已经在“转换设置”(在“参数”选项卡下)中将其“参数化”为StartDate = SYSDATE-45 EndDate = SYSDATE

It's not really parameterized, and I could just sub SYSDATE and SYSDATE-45 into the query, but I am trying to get the actual date values to be evaluated through a Get Variables step. 它不是真正参数化的,我可以将SYSDATE和SYSDATE-45子查询,但是我试图通过“获取变量”步骤获取要评估的实际日期值。 How I have it set up, it will only report SYSDATE-45 and SYSDATE, without evaulating them. 我如何设置它,它只会报告SYSDATE-45和SYSDATE,而不会评估它们。

Is there a way to convert SYSDATE into a date value in the Get Variables step? 是否可以在“获取变量”步骤中将SYSDATE转换为日期值?

The Parameter section of the PDI doesn't do any sort of query execution. PDI的“参数”部分不执行任何类型的查询。 If you have defined any value to a variable, there would be no change in the variable when you are passing to the job/transformation. 如果您为变量定义了任何值,则在传递给作业/转换时,变量将不会发生变化。

In your case, you need to execute SYSDATE and SYSDATE-45 first using either "Table Input Step" and then define the variable, instead of directly assigning SYSDATE to the variable startDate/endDate. 在您的情况下,您需要先使用“表输入步骤”执行SYSDATE和SYSDATE-45,然后定义变量,而不是直接将SYSDATE分配给变量startDate / endDate。 The below image might help you out : 下图可能会帮助您:

在此处输入图片说明

Hope this helps !! 希望这可以帮助 !! :) :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM