Hi Shong,
I have a situation,
i am having source table which contains lots of special characters in multiple columns.
i handled for single column using tReplace component but its very lengthy to take every column in tReplace which contains Special characters.
Is there any other way to handle multiple columns at a time for special characters.
This is the list of Special Characters that i have in my data and Replace_By value for every special characters
Waiting for positive reply.
Thanks, Shri_Kul1
Talend User
Hi Amol,
No, Metadata1 doesn't contain any null values. Null values are in metadata file which is lookup value and contains replace by column which contains null values.
My original job is like this.
Hi Sk,
I will try to make rough job.
metadata1 ------------- tReplaceList --------------------------- tLogRow
|
tMap
|
metadata
Now, try to implement this logic and make sure that replace null values in tMap before mapping.
I hope, it will work.
Regards,
Amol
Hi Everybody,
I need help from you,
I am trying to implement an ETL job. I have REMARK column in target table which holds remarks for every column if that particular column failed at validation.
Ex - Suppose that I Have ID column in source (Excel), it should hold only Numeric values but in case if it contains any character then that particular record should go under error table and Remark column hold remark that"ID should be Numeric."
Like wise, i need to implement it for multiple columns & REMARK column should be updated for every column if they all got failed at validation.
like
Date Fields
- Start_Date Should be less than End_Date.
Description
Field - Should contain only 1000 characters max to max.
Any
Required (*)
field should not be null.
Boolean
fields contain only TRUE & FALSE in capital form, should not contain any 'Yes', 'No',123 or null
Hi All,
I have done it after all, Please see image attached here and solution for it as follows-
1)Sort out data on the basis of EXPECTED & REJECTED records through your business rule like NAME should not be null if it is null then it should go under ERROR table. After that take 1 variable and put this logic - Source.triNameTX==null?"(triNameTX Should not be Null)":"" and use this variable in REMARK column of ERROR table.
2)START date should less that END date - Var2- (Source.triSTARTDA != null && (Source.triSTARTDA.before(Source.triENDDA))) ||
Source.triSTARTDA == null (Boolean Type)
Var3 -(Source.triSTARTDA!= null && (Source.triSTARTDA.after(Source.triENDDA)))||Source.triSTARTDA == null?"(triSTARTDA Should'nt be NUll or Less than triENDDA)":""
3) Now, Concatenate Var.var1+Var.var2 and run your job & after completion of your job take look into REMARK column , you will see -(triNameTX Should not be Null)(triSTARTDA Should'nt be NUll or Less than triENDDA).
so like wise you can do it for many columns as per your Business Rule.
tGroovyRow allows you to do row-based processing in the Groovy language (essentially a superset of Java). Since the tGroovyRow component gets its input as a HashMap named input_row, you can process each field of each row as a closure. That makes it very efficient to apply the same search/replace or other transformations to multiple fields on the same row.
See below for how I use this technique to remove all carriage returns and newlines from each field of type String. I'm also doing a null check and transforming that into an empty String before doing the replace operations.
FYI, to use this, you'll need "
tGroovyRow (updated)" (available at this link). It should be available in Talend Exchange soon once approved. I've tested it in TOS 6.1.1, Groovy 2.4.5 (bundled in my updated version), and Java 1.8.
The original "
tGroovyRow" is available in Talend Exchange, but I needed to tweak it before it would run in TOS 5.6.x and it uses the default version of Groovy (1.0) bundled with TOS.
input_row.each { key, value -> if (value.getClass() == String) value = value?.replace("\r","").replace("\n","") output_row = value }