Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
DrGenious
Creator
Creator

Loop into a table

Hello ,

 

I have a table in hive and I want through java to make a for statement with table's length. How can I do that? 

 

Thanks a lot.

Labels (2)
4 Replies
Anonymous
Not applicable

@DrGenious, can you take an example to explain your requirement?

 

Regards

Shong

DrGenious
Creator
Creator
Author

@shong 

for (int j = 0; j <names.length; j++) {
ls_table = names[j][0];

if ((input_row.Equipment_Id != null) && (ls_table != null) && (input_row.Equipment_Id_.startsWith(ls_table))) {
ls_info = "the name is  " + names[j][1];
}

 

I have the file with this names table, but I dont know: 1) How to upload it into talend.

                                                                                     2) How to loop with the table's name.

Anonymous
Not applicable

Sorry, I can't still understand your question well. However, if you want read data from file, you can use the tFileInputxxx component such as tFileInputDelimited(for .txt or .csv file), tFileInputExcel (for excel file).
To loop the table name read from file, you can use tFowToIterate component, something like:
tFileInputDelimited--main--tFlowToIterate--iterate....
Take a look at the component documentation and learn this component.

Regards
Shong
DrGenious
Creator
Creator
Author

@shong 

for (int j = 0; j <names.length; j++) {
ls_table = names[j][0];

if ((input_row.Equipment_Id != null) && (ls_table != null) && (input_row.Equipment_Id_.startsWith(ls_table))) {
ls_info = "the name is  " + names[j][1];
}

 

As you can see in the above code, there is a loop which loops until names.length ( names is the table). Then ls_table has the value of the names[j][0]. My question is how I insert this table into talend and then how can I loop with this table's length like the code above. I know about tfileinputdelimited and tflowiterate but I want to write it in java.