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: 
Parikhharshal
Creator III
Creator III

output_row.variable

Hi Talend experts

 

I have got few questions around output_row.variable not sure what this code is doing. can you please help me understand? (please refer to below screenshot for job ParentCheckExecLoad job where speicifically code is written for SetExecLoad component).

 

0683p000009Lzk1.png

 

for first SetExecLoad code is written like this:

 

boolean execload = false;

 

if (input_row.message.equals("failure") )

execload = true;

else

execload = false;

 

output_row.execload = execload;

 

System.out.println("execload:   "+execload);

 

For the second SetExecLoad it's written like this:

 

boolean execload = false;

 

if (((Integer)globalMap.get("tRedshiftInput_1_NB_LINE")) == 0)

execload = true;

 

output_row.execload = execload;

 

System.out.println("output_row.execload:  "+output_row.execload);

 

Then this parentcheckexecload is being referred in another job like this and execload is also set as shown in below photo.

 

0683p000009Lzi6.png

 

For this SetExecLoad below code is written:

 

globalMap.put("ExecLoad",input_row.execload);

 

I have no idea what does this actually do. Can someone please explain?

 

Thanks

Harshal

 

Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable

First of all you need to understand that the tJavaRow uses "input_row.{column_name}" to receive column values from your row and the "output_row.{column_name}" to set column values for the output row. So in your job, wherever "output_row" is used, it is basically setting the column value for the row leaving the component.

 

In the code below, the first SetExecLoad component is testing the value held by the message column. If it is "failure" then it sets an execload boolean to true, otherwise it sets it to false. This is not necessary as it is initialised to false above. It prints out the value of the execload to the output window and passes the execload value to the output_row.

 

In the second SetExecLoad component it essentially does the same but the setting of execload to true is based on the tRedshiftInput component returning 0 rows.

 

 

 

This bit of code.....

 

globalMap.put("ExecLoad",input_row.execload);

 

....sets the globalMap hashmap to have a value supplied by input_row.execload, linked to the key "ExecLoad". It can be retrieved with the following code.....

 

((Boolean)globalMap.get("ExecLoad"))

 

....assuming that "input_row.execload" is a boolean.

 

View solution in original post

3 Replies
Anonymous
Not applicable

First of all you need to understand that the tJavaRow uses "input_row.{column_name}" to receive column values from your row and the "output_row.{column_name}" to set column values for the output row. So in your job, wherever "output_row" is used, it is basically setting the column value for the row leaving the component.

 

In the code below, the first SetExecLoad component is testing the value held by the message column. If it is "failure" then it sets an execload boolean to true, otherwise it sets it to false. This is not necessary as it is initialised to false above. It prints out the value of the execload to the output window and passes the execload value to the output_row.

 

In the second SetExecLoad component it essentially does the same but the setting of execload to true is based on the tRedshiftInput component returning 0 rows.

 

 

 

This bit of code.....

 

globalMap.put("ExecLoad",input_row.execload);

 

....sets the globalMap hashmap to have a value supplied by input_row.execload, linked to the key "ExecLoad". It can be retrieved with the following code.....

 

((Boolean)globalMap.get("ExecLoad"))

 

....assuming that "input_row.execload" is a boolean.

 

Parikhharshal
Creator III
Creator III
Author

Hi rhall_2_0

Thanks a lot for your reply.
Really appreciated.

However, being new to Talend and Java world I still didn’t understand one thing which is this:

wherever "output_row" is used, it is basically setting the column value for the row leaving the component. Can you please elaborate more?

Thanks
Harshal.
Anonymous
Not applicable

All of your data will pass in rows through a Talend flow. Data enters a component in a row by row manner and leaves in the same way. In a tJavaRow you can receive the incoming row data to manipulate it using the input_row prefix, and when you have finished manipulating it you can send it to the next component using the output_row prefix.

It is highly advisable that you learn a bit of Java while learning Talend. It makes understanding how to use the tool a lot easier. It also helps tremendously with debugging.