You are not logged in.
Announcement
Unanswered posts
|
Pages: 1
If a row has 'N/A' , how do i convert it into NULL using tmap or for that matter any other function
Can we apply some IF condition ??
Hi
Yes, it is possible, what's the data type of column?
Best regards
Shong
Online
There are 2 columns with the same problem , One has Varchar and the second one has date.
Source is a csv , which has rows containing 'N/A' along with data ...
i am using version 3.2.1 .....
Should i use any other function ??
Thanks
Vikram
shong wrote:
Hi
Yes, it is possible, what's the data type of column?
Best regards
Shong
There are 2 columns with the same problem , One has Varchar and the second one has date.
Source is a csv , which has rows containing 'N/A' along with data ...
i am using version 3.2.1 .....
Should i use any other function ??
Thanks
Vikram

Hi
You can use TalendDate.parseDate for parsing the date column to your required format
eg
TalendDate.parseDate("yyyy-MM-dd HH:m:ss",Date)
You can change the format according to your use
Offline
Hi Lijo,
I have a csv file which contains 5 columns
2 columns have 'N/A' mentioned in them along with data , i am trying to convert 'N/A' to NULL
Of those 2 columns , one is DATE TYPE and other one is VARCHAR
I am using t_Map
For the VARCHAR the problem was solved with " row1.City.equals("N/A") ? null : row1.City "
For the Date column which contains dates along with 'N/A' , am unable to convert them 'N/A' to NULL.
I am populating data from CSV file to SQL server ...
SQL server has has same columns 5 columns , with the same data types.
Should i use any other function apart t_Map or add any other function ??
PS: Shong any suggestion ...
Thanks
Vikram

How can a date variable contain the value 'N/A'? If you mean that's the value in your file, then you need to read the file with that column defined as a String in the tFileInputDelimited schema, then use an expression like you've already discovered to remove the 'N/A' values and convert the result to a Date using Lijo's expression to write to MS SQL e.g. row1.myDate.equals("N/A")?null:TalendDate.parseDate("dd/MM/yyyy",row1.myDate).
Offline
Pages: 1