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

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
Thersa
4 days ago
globalMap.get("tMlelnputDelimited_1_NB_LINE") - the name alone makes me chuckle. What a mouthful!
upvoted 0 times
...
Kami
9 days ago
Definitely go with the "globalMap.get("tMlelnputDelimited_1_NB_LINE")" option. Can't go wrong with that.
upvoted 0 times
...
Alexis
14 days ago
globalMap.get("tMlelnputDelimited_1_NB_LINE") is the way to do it. Easy peasy.
upvoted 0 times
...
Frederick
19 days ago
I think the "globalMap.get("tMlelnputDelimited_1_NB_LINE")" is the way to go. Simple and straightforward.
upvoted 0 times
...
Titus
25 days ago
The correct answer is to use the "globalMap.get("tMlelnputDelimited_1_NB_LINE")" code.
upvoted 0 times
...
Susana
30 days 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
1 month ago
If I remember correctly, we might need to initialize a counter variable and increment it for each line read.
upvoted 0 times
...
Pa
2 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
2 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
2 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
2 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
3 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
3 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
3 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