简体   繁体   中英

How to create series of date range in INFORMATICA using transformations?

I have a need to create a report, where some dates are present in the table,however the requirement is the report should consist of every monday for the entire year irrespective of the data unavailability(it`ll show null for those dates).

How to achieve this logic in Informatica?

you need to use some DB for generate date series. And then join that series with your data to get what you want.

  1. for oracle you can get a dummy source from oracle(DUAL). and then in SQ query, you can overwrite using below SQL. for any other RDBMS you should get something like generate series to do this.
SELECT
  (to_date('01-05-2015','DD-MM-YYYY') - level + 1) AS dt
FROM dual
CONNECT BY LEVEL <= (to_date('01-01-2020','DD-MM-YYYY') - to_date('01-01-2040','DD-MM-YYYY') + 1)  

I assumed your start date is jan-20 and end date is jan-2040. You can change them if you want to. You need to make sure which date range you want to see in report.

  1. Then join this SQ using a joiner with your main pipeline. It should be master outer join where above source will be a details source. Join condition will be -
dt = trunc(dt_from pipeline)
  1. pull all columns including dt from source #1 into next transformation. Please note all columns from your original pipeline will be null if date doesnt exist in pipeline data.

Your data should look like -

dt                   Quantity
05-04-2015 00:00:00  1
04-04-2015 00:00:00  
03-04-2015 00:00:00  6
02-04-2015 00:00:00  9
01-04-2015 00:00:00  28

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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