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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to use tFileInputDelimited and Iterate

Hi,
i have a question to component tFileInputDelimited (and the other tFileInput components). There can be two row outputs: main and iterate. How to use main is clear. But how can i use iterate? How does it work? I didn't find any example for. Can anyone give me one please? Thank you. I use java projects.
Regards,
Falk
Labels (3)
5 Replies
Anonymous
Not applicable
Author

Hello
The 'iterate' link fires the next subJob based on each row, for example
tFileInputDelimited--Iteate--tJava
if there are three rows come from input component(tFileInputDelimited), tJava component will work three times.
Best regards

shong
Anonymous
Not applicable
Author

Hi Shong,
i understand what you mean, but not realy how it works. I looked in the generated source code from TOS and didn't find how i can access the fields each row. I created a simple job. tFileDelimited input (with two culumns named "newColumn" and "newColumn1") and an iterate connection to tJava. I'am using TOS 3.2.1.
				while (fid_tFileInputDelimited_1.nextRecord()) {
/**
* stop
*/
/**
* start
*/
currentComponent = "tFileInputDelimited_1";
tos_count_tFileInputDelimited_1++;
/**
* stop
*/
NB_ITERATE_tJava_1++;
/**
* start
*/
ok_Hash.put("tJava_1", false);
start_Hash.put("tJava_1", System.currentTimeMillis());
currentComponent = "tJava_1";
int tos_count_tJava_1 = 0;
String foo = "bar";
/**
* stop
*/
/**
* start
*/
currentComponent = "tJava_1";
tos_count_tJava_1++;
/**
* stop
*/
/**
* start
*/
currentComponent = "tJava_1";
ok_Hash.put("tJava_1", true);
end_Hash.put("tJava_1", System.currentTimeMillis());
/**
* stop
*/
/**
* start
*/
currentComponent = "tFileInputDelimited_1";
}
Anonymous
Not applicable
Author

Hello
I looked in the generated source code from TOS and didn't find how i can access the fields each row

If you want to access the fields each row, you can use tFlowToIterate component, about its usage, see 5827.
Best regards

shong
Anonymous
Not applicable
Author

Hi Shong
thank you for your answer. For me it is not easy to understand why i must send a main stream to a tFlowToIterate, because tFileDelimited already use a iterate. Which information are sending to tJava in our example with iterate? Only the number of rows i see. Is it right?
Regards
Falk
Anonymous
Not applicable
Author

Well, I identify that when ITERATE is in use and to access a field, you can use 
fid_tFileInputDelimited_1.get(indx)

Where indx is the number of column that you want to access.
I prefer always access direct to the object in the iterate instead of use an tFlowToIterate, because these component sometimes present strange behaviour and for the cost (in memory) of use a proxy (like a tFlowToIterate).