One Star

[resolved] Using TJavaRow for conditional flow control

Hello everyone,

I am comparatively new to Talend and am trying to establish certain checks towards my data integration process which picks up data from an SFTP and copies it to Redshift Datawarehouse.

As a part of this process, I intend to validate my column names to ensure that before I pick up my data, the header names are validated. To do the same, I am reading the header row of my file using 
tFileInputFullRow (with limit=1) and want to use TJavaRow to do a boolean check on the variable name.
 tFileInputFullRow----tJavaRow--tJava--if(false)--take action
                                               |
                                            If(True)
                                                |
                                           tFileInputDelimited


To be more specific, I am facing issues in the step where we use TJavaRow component to write the Java query:

context.result= line1.equalsIgnoreCase("col1,col2,col3");

I am using the following query:

"Boolean result = false;
globalMap.put("result",result);

result=row4.equalsIgnoreCase("list_id,list_name,campaign_id,template_name,event,event_date,email");
"

Could you kindly help me out in sorting the variable result to get the desired output.
I guess there is some problem in the underlined part of the Java code.

Thanks and Regards,
Shobhit

1 ACCEPTED SOLUTION

Accepted Solutions
Community Manager

Re: [resolved] Using TJavaRow for conditional flow control

Hi 
To access the input column, use this expression:
Boolean result=false;
result="list_id,list_name,campaign_id,template_name,event,event_date,email".equalsIgnoreCase(input_row.line);
globalMap.put("result",result);

Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
1 REPLY
Community Manager

Re: [resolved] Using TJavaRow for conditional flow control

Hi 
To access the input column, use this expression:
Boolean result=false;
result="list_id,list_name,campaign_id,template_name,event,event_date,email".equalsIgnoreCase(input_row.line);
globalMap.put("result",result);

Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business