How to achive from one Date to multiple dates

Five Stars

How to achive from one Date to multiple dates

Source_1.PNGsourceTarget_1.PNGtarget

By using this source file how to get multiple dates in order

 

Fifteen Stars TRF
Fifteen Stars

Re: How to achive from one Date to multiple dates

Using TalendDate routines (https://help.talend.com/display/TalendOpenStudioforBigDataUserGuide520EN/10.5+TalendDate+Routines) compute the difference between start and end date, then tLoop from 1 to nb_days, add i to start date giving current date. You got what you need for your job.

TRF
Five Stars

Re: How to achive from one Date to multiple dates

Can you please help me.I tried with tjava and tloop but not able to do

Seven Stars

Re: How to achive from one Date to multiple dates

This is actually a bit tricky.

 

  

I did some rough work and came up with this solution. Hope it gives you some idea.

 

You have to first calculate the difference between the start date and end date and store it in a context value.

Then for each row, you have to use the tLoop component to generate the missing dates.

 

The layout of the job,

dataFlow.PNG

tMap12 Config,

tMap12.PNG

 

tJava Code,

 

tjava1.PNG

 

tLoop Config,

tLoop.PNG

tFixedFlow Component Config,

tfixedFlow.PNG

 

 

 

tMap13 config,

tMap13.PNG

Here we have two contexts created. One is the context Loop of integer datatype for storing the max loop number.

Other one is the context startDate of datatype date for storing the starting date.

Remember to check the append option if your output is a file.

 

There might be a better way to do this. Hopefully this template gets you started on what you want.

 

 

 

 

Five Stars

Re: How to achive from one Date to multiple dates

thank u very much i will try and let u know

Fifteen Stars TRF
Fifteen Stars

Re: How to achive from one Date to multiple dates

Hi,

Thanks to @ArvinRapt to have detailed the solution I proposed.

I don't think it's too much tricky.

Maybe you can change tJava by tSetGlobalVar and use global variables instead of context variables, but it's a detail.

Also I think you can move the operation made in the tMap into the tFixedFlowInput component to comple the startDate field.

 

Regards,


TRF
Seven Stars

Re: How to achive from one Date to multiple dates

@TRF Agreed. Those two suggestions make the job easier on the eyes.

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

Talend API Designer – Technical Overview

Take a look at this technical overview video of Talend API Designer

Watch Now

Getting Started with APIs

Find out how to get started with APIs

Read