Get currnent date and compare to MAX date in table currently

One Star

Get currnent date and compare to MAX date in table currently

Hello,

I would like to be able to do this:

when I load in data from a csv file i want to add the current date to a certain column. then there is a 'version' column. So when a new file is loaded, the MAX(version) should incremented by 1 and then used as a value in the 'version' column.

So i was thinking to compare todays date against the MAX(date) in the table currently. if the MAX(date) was less than today, then it would set a session var for the 'version' otherwise it woudl then set the session 'version'

Is something like this possible?
I dont want to use a multi-column index as there may be columns that dont match up.

Thanks.

Re: Get currnent date and compare to MAX date in table currently

This is really two problems, no?

1) add current date to column:

in a tmap before your database output, add a column and use the builtin talend function to get the current date. in the Perl version (which I highly recommend) this funciton is getDate()

2) max version +1
use a database input to get the MAX(version) pass that row into a tPerlRow component and save it in a variable. $MAX_VERSION = $input_row[max_version] + 1;
then later, use the $MAX_VERSION varible in your tmap to populate the output.

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

Have you checked out Talend’s 2019 Summer release yet?

Find out about Talend's 2019 Summer release

Blog

Talend Summer 2019 – What’s New?

Talend continues to revolutionize how businesses leverage speed and manage scale

Watch Now

6 Ways to Start Utilizing Machine Learning with Amazon We Services and Talend

Look at6 ways to start utilizing Machine Learning with Amazon We Services and Talend

Blog