One Star

[resolved] Get the current Date into a Schema definition

Hi,
I'm runing out of tips trying to handle a default value for a date.
Is it possible to get the current date as default value into a metadata schema ?

I've tried TalendDate.getCurrentDate(), new java.util.Date(), sysdate etc... nothing works. I really want to handle it into the metadata, it seems much more "clean" to me, to handle it here, I don't wanna use variables into tmap or tJava that is too tricky, and I want to keep my jobs easy to maintain !
3 REPLIES
Moderator

Re: [resolved] Get the current Date into a Schema definition

Hi,
You cannot use TalendDate.getCurrentDate() as default value in schema setting.
You have to use the expression you already know in the tMap or tJava.
The default values in the database will only be used if you do not fill the column and set null as value is always a attempt to fill the column and prevents the database from setting the default value.
For default value, please take a look at a KB document:https://help.talend.com/search/all?query=Verifying+default+values+in+a+retrieved+schema&content-lang...
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.
One Star

Re: [resolved] Get the current Date into a Schema definition

Thanks Sabrina, that's too bad but I can deal with it
Let's use tmap then
Moderator

Re: [resolved] Get the current Date into a Schema definition

Hi,
Feel free to let us know if there is any further help we can give.
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.