• Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » [resolved] URGENT - How to get a string part

#1 2012-02-21 16:20:55

ienax_ridens
Member
Registered: 2010-10-27
Posts: 50

[resolved] URGENT - How to get a string part

I know RIGHT and LEFT commands, my question is: how can I get a string part that's into the string?

I have "12-34-5678", I wanna get "34".

I need to do this, because I retrieve a 'date' from SQL server with "dd-MM-yyyy" pattern, but I need to do 2 things:
1 - put the date as "yyyy-MM-dd"
2 - check if the date is null (I need to do the logic of the following code: row1.DATE_FIELD == null ? "0001-01-01" : row1.DATE_FIELD)

Input is SQL Server table and Output is a tFileOutputPositional.

Thank about the answer

---------ADD----------
I've tried the following code, but I had an error building job:

row2.DATA_CESSAZIONE == null ? "2999-12-31" :

RIGHT(row2.DATA_CESSAZIONE,4)
+"-"
+RIGHT(LEFT(row2.DATA_CESSAZIONE,5),2)
+"-"
+LEFT(row2.DATA_CESSAZIONE,2)

Last edited by ienax_ridens (2012-02-21 16:43:26)

Offline

#2 2012-02-21 18:00:30

ienax_ridens
Member
Registered: 2010-10-27
Posts: 50

Re: [resolved] URGENT - How to get a string part

Solution found:

Table --> tMap1 (change of date pattern "dd-MM-yyyy" to "yyyy-MM-dd") --> tConvert (date to string) --> tMap2 --> tFileOutputPositional

I think this could help someone.

bye

Offline

  • Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » [resolved] URGENT - How to get a string part

Board footer

Powered by FluxBB