简体   繁体   English

Informatica PowerCenter

[英]Informatica powercenter

I have a flat file as source which contains two columns named "Event begin time" and "event end time" that has both date and time in it . 我有一个平面文件作为源,其中包含名为“事件开始时间”和“事件结束时间”的两列,其中同时包含日期和时间。 How can I calculate MOU(minutes of usage) for it using Informatica. 如何使用Informatica计算MOU(使用时间分钟数)。 Please help me.. 请帮我..

Thanks Vinay 感谢Vinay

DATE_DIFF函数可用于计算持续时间:

DATE_DIFF( Event_End_Time, Event_Begin_Time, MI) 

First you need Informatica to know that each of the 2 dates from the flat file are indeed dates and the format from the INCOMING date fields, you will do this by passing them to an expression transformaton ie if they are in 'DD/MM/YYYY HH24:MI:SS' then the expression to turn them into date/time in informatica will be TO_DATE (EVENT_BEGIN_TIME, 'DD/MM/YYYY HH24:MI:SS') (You'll have to do same for event end time... I've used name with underscores instead of spaces as informatica doesnt allow spaces in port names) 首先,您需要Informatica知道平面文件中的2个日期中的每个确实是日期,而INCOMING日期​​字段中的日期确实是格式,您可以通过将它们传递给表达式transformaton来实现,即如果它们位于'DD / MM / YYYY中HH24:MI:SS”,那么将其转换为informatica中的日期/时间的表达式将为TO_DATE(EVENT_BEGIN_TIME,“ DD / MM / YYYY HH24:MI:SS”)(事件结束时间必须这样做。 ..我使用带下划线的名称代替空格,因为informatica不允许在端口名称中使用空格)

Then you'll use datediff to subtract the begin time from the end time... lets say you named the 2 variable ports which contain the above calculation as v_BEGIN and v_END, the calculation for minutes will be DATE_DIFF(v_BEGIN, v_END, 'MI') 然后,您将使用datediff从结束时间中减去开始时间...假设您将包含上述计算的2个变量端口命名为v_BEGIN和v_END,分钟的计算将为DATE_DIFF(v_BEGIN,v_END,'MI ')

Simplest way of achieving it : Consider T1 and T2 as Start time and end time (Ensure that,both are in DATE Format). 实现它的最简单方法:将T1和T2视为开始时间和结束时间(确保两者均为DATE格式)。

In variable calculate T2-T1 : This will give you difference in days. 在变量中计算T2-T1:这将为您带来天数差异。 Multiply it by ( 24*60 ) will give you number of minutes. 将其乘以(24 * 60)即可得到分钟数。 So, 24*60*(T2-T1). 因此,为24 * 60 *(T2-T1)。

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

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