I'm trying to check if a field is nullable i.e. if a column can have NULL values.
Although the schema includes the boolean field "nullable", the following code snippet does not return if a field is nullable:
Field fields = row1.getClass().getDeclaredFields();
Is there any way to retrieve the information if a column according to the schema is nullable?
Best regards and many thanks in advance
If it is a simple check, you can do it in tMap itself like below
Relational.ISNULL(row1.field)?"true part":"false part"
If you want to check the details with a schema, you can use the tSchemaComplianceCheck component. Could you please share more idea about your use case with some sample data so that we can understand why a tJavaFlex is needed?
Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved :-)
The generated code with or without the nullable checkbox ticked are absolutly the same.
Well, at least with a minimal job with a tFixedInputFlowInput and a tJavaRow component.
Not sure what you're asking is possible.
Maybe this link may helps https://www.talendforge.org/forum/viewtopic.php?id=27308
@nikhilthampi the question is about nullable fileds detection, not null value detection during row processing.
Talend named a Leader.
Kickstart your first data integration and ETL projects.
Watch the recorded webinar!
Part 2 of a series on Context Variables
Learn how to do cool things with Context Variables
Find out how to migrate from one database to another using the Dynamic schema