Load previous day data as a start data for the next day in Talend

Highlighted
Five Stars

Load previous day data as a start data for the next day in Talend

Hi Team,

 

I am trying to design a job which will capture Daily power readings. The input file contains data of the daily readings for different power reading meters. The readings of the output have to be updated as the start data and end data .The readings of the previous day reading of a meter should be loaded as start date for that meter for the next day. and the readings will be loaded directly as end data

ie 

INPUT
Meter_Name Datereadings
A20/10/2019100
B20/10/2019150
A21/10/2019300
B21/10/2019250

 

 

the expected output is 

Meter_NameDateStart DataEnd Data
A20/10/2019 100
B20/10/2019 150
A21/10/2019100300
B21/10/2019150250

 

Please suggest a method to implement this logic in Talend  job.


Accepted Solutions
Employee

Re: Load previous day data as a start data for the next day in Talend

Hi,

 

    Its very easy with Talend. Please refer the below screenshots.

image.png

 

image.png

 

You need to read the same file twice for main and lookup flow. In the lookup join condition, you need to join based on meter name and date -1. The function for date -1 is as shown below.

 

TalendDate.addDate(row1.reading_date,-1,"DD") 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved

 


All Replies
Employee

Re: Load previous day data as a start data for the next day in Talend

Hi,

 

    Its very easy with Talend. Please refer the below screenshots.

image.png

 

image.png

 

You need to read the same file twice for main and lookup flow. In the lookup join condition, you need to join based on meter name and date -1. The function for date -1 is as shown below.

 

TalendDate.addDate(row1.reading_date,-1,"DD") 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved

 

Five Stars

Re: Load previous day data as a start data for the next day in Talend

Thanks @nikhilthampi . It worked for me. 

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 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog