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.

 

2 REPLIES
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.