Search code examples
talend

Talend - how to run a block of components in a loop?


Can you please advise how to run the following block of components in a loop? I highlighted the portion of the URL that I need to iterate: It should be: context.startIndex*1, context.startIndex*2, context.startIndex*3...etc, etc, up to 100.

Is it possible to use a tLoop? Please provide a description of the method.

Thank you, Mircea

enter image description here


Solution

  • Yes, you should be able to do so, just by adding a tLoop after the onComponentOK link, and connect components like this :

     tLoop --iterate--> tFixedFlowInput --main--> tRestClient
    

    (tFixedFlow is just here to let you connect tLoop to tRestClient)

    Basic settings in tLoop : from/to/step : 1/100/1 In your tRestComponent, you should use the globalMap variable provided by your tLoopComponent :

    ..startIndex="+context.startIndex*((Integer)globalMap.get("tLoop_1_CURRENT_ITERATION"))
    

    Use the 'Outline' view to get the global variables you can access with your components.