I am trying to build data verification in a Talend Java component (currently using a tJavaRow), where the fields being processed are checked against the String Size in the output row field.
This validation would be used to identify if columns contain Strings which are larger than intended and alert about these but still process others in the same row.
I have found information on getting the sizes for dynamic schemas but there does not seem to be any information for normal String Length.
In a nutshell, from a Java component I would like to get the Length from the output row schema for each field.
Is this possible?
Maybe tSchemaCompilanceCheck component can fit your need for data validation? Can you please show us some data to explain your requirement?
Hi Shong, thanks for your reply.
Currently I have implemented the tSchemaComplianceCheck for validation, but this will only validate per complete row and per column.
I want to be able to check per column and only lose a column's data rather than a complete row.
Attached is my implementation where in the tJavaRow I am doing the mappings and would like to do the validations.
As stated I want a validation on the Output column so that if the input data size is larger than the output column size, only the column's data is lost.
I am already able to get the output column instance through java.lang.reflect and identify it's datatype, but haven't managed to get a column's length/size.
As you explained I can make a check by hardcoding the values for validation but whenever there is a change in the output column I would need to change the code as well.
Ideally I have this done programmatically through Java as it would save time in implementing changes.