TalendDate.getCurrentDate() with in Expression builder returning same date throughout the Route execution

Six Stars

TalendDate.getCurrentDate() with in Expression builder returning same date throughout the Route execution

Hi,

 

I am using this below expression in the cSetBody. 

Language: SIMPLE

Expression: "This messaged is generated in a Route at :" + TalendDate.getCurrentDate()

 

The issue is, In each message I am getting the same datetime even though messages are parted by 1 min. How can I get the current time on each message body? 

I tried using the Numeric.sequence("MessageCount", 1,1) in the expression builder. that is also always returning 1 every time a new message is generated. why is that?

 

Thanks,

Sowjanya.

 

Moderator

Re: TalendDate.getCurrentDate() with in Expression builder returning same date throughout the Route execution

Hi,


@sowjanya wrote:

Hi,

 

I am using this below expression in the cSetBody. 

Language: SIMPLE

Expression: "This messaged is generated in a Route at :" + TalendDate.getCurrentDate()

 

The issue is, In each message I am getting the same datetime even though messages are parted by 1 min. How can I get the current time on each message body? 

I tried using the Numeric.sequence("MessageCount", 1,1) in the expression builder. that is also always returning 1 every time a new message is generated. why is that?

 

Thanks,

Sowjanya.

 


What does your expected result look like? Could you please set an example for us?

Best regards

Sabrina

 

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Six Stars

Re: TalendDate.getCurrentDate() with in Expression builder returning same date throughout the Route execution

My expectation is to log the below messages, given that the route started at 15:03:55 and cTimer is set to generate messages with a delay of 1 min. 

 

> "This messaged is generated in a Route at : Wed Oct 11 15:03:55 PDT 2017"

> "This messaged is generated in a Route at : Wed Oct 11 15:04:55 PDT 2017"

> "This messaged is generated in a Route at : Wed Oct 11 15:05:55 PDT 2017"

> "This messaged is generated in a Route at : Wed Oct 11 15:06:55 PDT 2017"

> "This messaged is generated in a Route at : Wed Oct 11 15:07:55 PDT 2017" ....and so on. 

 

Issue is that it prints the same time even for a message generated  30 mins after the route has started. 

> "This messaged is generated in a Route at : Wed Oct 11 15:03:55 PDT 2017"

 

thanks,

Sowjanya.

 

 

 

What’s New for Talend Spring ’19

Watch the recorded webinar!

Watch Now

Agile Data lakes & Analytics

Accelerate your data lake projects with an agile approach

Watch

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.

Download

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch