Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Talend Data-Integration-Developer Exam - Topic 5 Question 50 Discussion

You need to calculate the total number of rows in an input file using a tMlelnputDelimited component.Which code should you use in a tJava component to write a nb-line variable?
C) Int nb.line-(integer)globalMap.put(''tFileInputDelimited_1_NB_LINE'')
A) Int nb_line-(integer)globalMap.put(''tFileInputDelimited_1_NB_LINE'')
D) Int nb_line-(String )globalMap.put(''tFileInputDelimited_1_NB_LINE'')
B) Int nb_line=(integer)globalMap.put(''tFileInputDelimited_1_NB_LINE'')

Talend Data-Integration-Developer Exam - Topic 5 Question 50 Discussion

Actual exam question for Talend's Data-Integration-Developer exam
Question #: 50
Topic #: 5
[All Data-Integration-Developer Questions]

You need to calculate the total number of rows in an input file using a tMlelnputDelimited component.

Which code should you use in a tJava component to write a nb-line variable?

Show Suggested Answer Hide Answer
Suggested Answer: C

You need to use the following code in a tJava component to write a nb_line variable:

int nb_line = (Integer)globalMap.get(''tFileInputDelimited_1_NB_LINE'');

This code retrieves the value of the global variable tFileInputDelimited_1_NB_LINE, which stores the number of rows processed by the tFileInputDelimited component, and assigns it to an integer variable named nb_line. You can then use this variable to print or manipulate the number of rows in your Job. Note that you need to use globalMap.get, not globalMap.put, to access the value of a global variable.


Contribute your Thoughts:

0/2000 characters
Kenneth
23 days ago
I thought you could use a different method too.
upvoted 0 times
...
Jenelle
28 days ago
Wait, is that the only way to do it?
upvoted 0 times
...
Nickolas
1 month ago
Totally agree, that's the right approach!
upvoted 0 times
...
Timothy
1 month ago
You can use globalMap.put("nb_line", rowCount);
upvoted 0 times
...
Samuel
1 month ago
globalMap.get("tMlelnputDelimited_1_NB_LINE") - it's like a tongue twister, but it works!
upvoted 0 times
...
Thersa
2 months ago
globalMap.get("tMlelnputDelimited_1_NB_LINE") - the name alone makes me chuckle. What a mouthful!
upvoted 0 times
...
Kami
2 months ago
Definitely go with the "globalMap.get("tMlelnputDelimited_1_NB_LINE")" option. Can't go wrong with that.
upvoted 0 times
...
Alexis
2 months ago
globalMap.get("tMlelnputDelimited_1_NB_LINE") is the way to do it. Easy peasy.
upvoted 0 times
...
Frederick
2 months ago
I think the "globalMap.get("tMlelnputDelimited_1_NB_LINE")" is the way to go. Simple and straightforward.
upvoted 0 times
...
Titus
2 months ago
The correct answer is to use the "globalMap.get("tMlelnputDelimited_1_NB_LINE")" code.
upvoted 0 times
...
Susana
3 months ago
I feel like there was something about using a loop in the tJava component, but I can't remember how to implement it for counting rows.
upvoted 0 times
...
Merissa
3 months ago
If I remember correctly, we might need to initialize a counter variable and increment it for each line read.
upvoted 0 times
...
Pa
3 months ago
I remember practicing a similar question where we had to use a tJava component to manipulate data, but I can't recall the specific code for nb-line.
upvoted 0 times
...
Julene
4 months ago
I think we need to use a method to read the file and count the lines, but I'm not sure about the exact syntax.
upvoted 0 times
...
Joni
4 months ago
No problem, I've done something like this before. In the tJava component, I'll use a simple loop to count the rows as I read through the file with tMlelnputDelimited, then set the nb-line variable at the end.
upvoted 0 times
...
Fausto
4 months ago
This is a tricky one. I'm not sure if I should be using a tJava component or if there's a more direct way to get the row count in Talend. I'll need to experiment a bit.
upvoted 0 times
...
Glory
4 months ago
Okay, I think I've got a strategy for this. I'll use the tMlelnputDelimited component to read the input file, then in the tJava component I'll count the number of rows and assign that to the nb-line variable.
upvoted 0 times
...
Alisha
4 months ago
I'm a bit confused on how to write the code in a tJava component to set the nb-line variable. I'll need to review the Talend documentation carefully.
upvoted 0 times
...
Thea
4 months ago
Hmm, this seems straightforward. I'd probably start by looking at the tMlelnputDelimited component documentation to see how to get the total number of rows.
upvoted 0 times
...

Save Cancel