create a date "DD" with a tmap

One Star

create a date "DD" with a tmap

hello i want to create a date with my tmap with the format 'DD'
exemple :
'24/08/1986' =>'24'
thank you
anaïs
One Star

Re: create a date "DD" with a tmap

please have a look to this screenshot because there is a really easy way to do it
One Star

Re: create a date "DD" with a tmap

i know i can do that but when i want to insert the date 'DD' into a table mysql
i can't insert it because in talend i have a date and in mysql i have a varchar(2) or varchar(4)
One Star

Re: create a date "DD" with a tmap

ok I didn't understand you question so the answer is :
One Star

Re: create a date "DD" with a tmap

I HAVE THIS ERROR in my job and i don't understand why:
Starting job agrement at 16:36 25/03/2008.
Exception in component tMap_1
java.lang.NullPointerException
at java.util.Calendar.setTime(Unknown Source)
at java.text.SimpleDateFormat.format(Unknown Source)
at java.text.SimpleDateFormat.format(Unknown Source)
at java.text.DateFormat.format(Unknown Source)
at routines.TalendDate.formatDate(TalendDate.java:33)
at test1.agrement.agrement.tOracleInput_1Process(agrement.java:1562)
at test1.agrement.agrement.runJobInTOS(agrement.java:2568)
at test1.agrement.agrement.main(agrement.java:2431)
Job agrement ended at 16:36 25/03/2008.
One Star

Re: create a date "DD" with a tmap

where the date value comes from? Can you give me a screenshot of your tmap configuration?
thanks?
One Star

Re: create a date "DD" with a tmap

this is the screenshot
One Star

Re: create a date "DD" with a tmap

Hi,
cahsohtoa's soultion is right. The problem is that you have null-values in your date. So change the code to the following:
row2.Date == null ? "" : TalendDate.formatDate("dd",row2.Date);

You should think about your default value if the Date is null. In this example just "".
Bye
Volker
One Star

Re: create a date "DD" with a tmap

i have also a null pointer exception with my tmap
Starting job agrement at 09:38 26/03/2008.
Exception in component tMap_1
java.lang.NullPointerException
at test1.agrement.agrement.tOracleInput_1Process(agrement.java:898)
at test1.agrement.agrement.runJobInTOS(agrement.java:1990)
at test1.agrement.agrement.main(agrement.java:1853)
Job agrement ended at 09:38 26/03/2008.
i have just changed the expression of my tmap with the date, it s strange because i have 4875 lines inserted in my table but the others lines aren't inserted
One Star

Re: create a date "DD" with a tmap

can i have some help please?
One Star

Re: create a date "DD" with a tmap

Is there any specialty on the other lines? Particularly null values in some attributes?

Calling Talend Open Studio Users

The first 100 community members completing the Open Studio survey win a $10 gift voucher.

Start the survey

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 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Why Companies Move to the Cloud: 7 Success Stories

Learn how and why companies are moving to the Cloud

Read Now