Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
BeginnerNeedsHelpPlease

tflowtoiterate : what does "use the default (key value in global variable" means?

hELLO

can you tell me how Am I supposed to use the tflowtoiterate component when I check the box to use the default (key value in global variable?

I see examples wihtout using the default (key value in global variableAnd I think i Understanf how to use it.

But i'm totally confused of what happened and I don't know when i'm supposed to chekc this box.

can you give me an example?

Labels (2)
6 Replies
anselmopeixoto
Partner - Creator III
Partner - Creator III

Hi @adi nul​ 

 

When you enable the "use the default key value in global variable" option on tFlowToIterate, it means that it will create a global variable automatically for each column on the input schema. The variable names will be set based on the row name and the column names on the input schema.

 

Suppose you have an input component connected to tFlowToIterate through a row called "row1" and this input component has two columns on its schema: "id" of Integer data type and "name" of String data type.

 

Then, tFlowToIterate will create row1.id and row1.name global variables automatically and you can get those variables content using the following expressions:

 

((Integer)globalMap.get("row1.id"))

((String)globalMap.get("row1.name"))

 

Usually, tFlowToIterate show the variables it creates on the outline view of Talend Studio, but sometimes you need to close and open the Job again to refresh the variables list.

 

If you disable the "use the default key value in global variable" option, it means that you'll define the global variables created by tFlowToIterate manually.

BeginnerNeedsHelpPlease
Author

thanks, I think I got it.

Regarding the global variable, is there a shorcut to type them?

I did some test and I have to type "((Integer)globalMap.get("row1.id"))" letter by letter on my keyboard.

When I use context, I can use the shorcut "crtl" + "space" to get some contexts and just select the one I want

Anonymous
Not applicable

Hello,

Feel free to let us know if this documentation is what you are looking for

https://help.talend.com/r/en-US/8.0/studio-user-guide/setting-field-dynamically-ctrl-space-bar

Best regards

Sabrina

BeginnerNeedsHelpPlease
Author

I'm not sure this documentation answers my question

 

When I want to use a global variable created automatically by tFlowToIterate (such as ((String)globalMap.get("row1.name")) ), I can't get it dynamically.

Do you know what I mean? I have to write it character ny character? Is there a way to get it dynamically because 'ctlr space' does not work here

anselmopeixoto
Partner - Creator III
Partner - Creator III

Hi @adi nul​ 

 

By typing the shortcut @Xiaodi Shi​ mentioned before, tFlowToIterate global variables will be shown at the proposals list.

 

Try pressing Ctrl+Space and start typing "tFlow..." (case sensitive) and it will filter the options available:

 

0695b00000lwMPMAA2.png 

 

 

Anonymous
Not applicable

Hello,

In a job, you are able to fill up a field or expression with a variable, press Ctrl+Space to access the variable list and choose the variable to use from it.

As tFlowToIterate requires an output component, you could use tJava to print the result.

 

0695b00000lwaDKAAY.pngFor parent and child jobs, here is also a related scenario about:

ttps://help.talend.com/r/en-US/8.0/orchestration/component-trunjob-pass-value-from-parent-to-child

In this use case, you have to define a context variable(Cross jobs) to pass the value.

Hope it helps.

Best regards

Sabrina

 

 

Best regards

Sabrina