简体   繁体   中英

Talend - How to get tFlowToIterate size and tFileInputRegex size?

Good day,

I have component tFileInputRegex and tFlowToIterate to read data from a text file, I saw there are number of row record being process as follow:

在此处输入图像描述

Which is 3412 rows, may I know how can I get this value in tJava_2 ?

currently I am using _NB_LINE but getting null:

System.out.println("total is " + (Integer)globalMap.get("tFileInputRegex_1_NB_LINE"));

System.out.println("total2 is " + (Integer)globalMap.get("tFlowToIterate_2_NB_LINE"));

In your example, tJava_2 executes within the iteration, ie once for each row. In that component, you can use globalMap.get("tFlowToIterate_2_CURRENT_ITERATION").toString() to get the number of rows processed so far. Please note that instead of casting it to Integer you need to convert it to a string as shown above in order to output it the way you do. If you need the total number of rows, you can use globalMap.get("tFileInputRegex_1_NB_LINE").toString() - but it is only available after the end of the loop, which means the component where you access it needs to be connected to tFileInputRegex_1 via OnSubjobOk trigger.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM