Dynamic Schema not working Properly.

Five Stars

Dynamic Schema not working Properly.

I'm reading data from Oracle database and storing into file.

 

Note: I want to do it using dynamic Schema only, I have reasons so please deal with my concern

Here is the data

 

ID|Name|LastName|Location|Department|DateJoin


100|Joy|Paul|London|Sales|01-12-2017 10:00:00


toracleInput--------->tJavarow--------->tFileoutputDelimited


Below is the output when I mention date format(yyyy-MM-dd HH:mm:ss) in dynamic schema Date's format window.


ID|Name|LastName|Location|Department|DateJoin


100|Joy|Paul|London|Sales|2017-12-01 10:00:00


But when I mention date format(dd-Mm-yyyy HH:mm:ss) in dynamic schema Date's format window.

ID|Name|LastName|Location|Department|DateJoin (I always want this format only)
100|Joy|Paul|London|Sales|dd-MM-yyyy 10:00:00

 

what happens to my Job that sometimes even after setting my Dynamic schema date to (dd-Mm-yyyy HH:mm:ss), it produces different date format(yyyy-MM-dd HH:mm:ss) in output....? Why is it so...? Its a case when no tjavarow component is present, Direct connection.


What should I do to avoid this use case so that I could recieve every time dd-Mm-yyyy HH:mm:ss in output.


Do you think so in below job setting, it can avoided, not matter what date format comes and what date pattern is set in Dynamic schema window, it will give me only dd-Mm-yyyy HH:mm:ss in output ?


toracleInput--------->tJavarow--------->tFileoutputDelimited

 

 

int ncount=0;
String columnName="";
DynamicMetadata column;

ncount=row7.c.getColumnCount();
column=row7.c.getColumnMetadata(5);
columnName=column.getName();
String IncolumnValue = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(row7.c.getColumnValue(columnName));
System.out.println("InputDate: "+IncolumnValue);
SimpleDateFormat reqPattern = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date reqDate = reqPattern.parse(IncolumnValue);
row7.c.setColumnValue(5,reqDate);
row8.c = row7.c;

Note: This code is also not working as expected, gives output on the basis of what is set in Dynamic schema's date pattern window.

Twelve Stars

Re: Dynamic Schema not working Properly.

Since you are using dynamic schema right,what you have define the date format in tFileoutputDelimited of dynamic schema,that will be populated.

Manohar B
Five Stars

Re: Dynamic Schema not working Properly.

@manodwhb That's true. But what to do when we get a date format in output which is different from mentioned in dynamic schema window...?

 

My job shows this behaviour thrice in a week and produce different format in output.  May I know please what could be the reason for that ? And How this can be handled within dynamic schema if job produce  date format which is different from the one mentioned in Dynamic schema window.