ComposantsComponents

ComposantsComponents › Orchestration

tIterateToFlow

tIterateToFlow

Orchestration

Transforme des itérations en lignes. À chaque itération d'un tFileList, d'un tLoop ou d'un tFlowToIterate, il calcule une ligne avec les expressions de son Mapping, le plus souvent des variables globales ; une fois la boucle finie, il envoie toutes ces lignes dans un flux Main. Pour écrire la liste des fichiers d'un dossier dans une table, ou obtenir une ligne par tour de boucle. Turns iterations into rows. At each iteration of a tFileList, a tLoop or a tFlowToIterate, it computes a row with the expressions of its Mapping, most often global variables; once the loop is over, it sends all these rows in a Main flow. To write the list of files of a folder to a table, or get one row per loop turn.

EntréeInput

Iterate un lien, obligatoire : il ne commence pas de sous-jobone link, required: it does not start a subjob

SortieOutput

Main un flux, avec le schéma du composant : une ligne par itérationone flow, with the component schema: one row per iteration

Déclencheurs en sortieOutput triggers

On Component Ok On Component Error Run if

UtilisationUsage

Après un tFileListAfter a tFileList

Iterate row1 (Main) tFileList_1 tIterateToFlow_1 tLogRow_1

Le cas le plus courant : une ligne par fichier, avec son nom, son chemin ou sa taille, vers un fichier, une table ou un tMap. The most common case: one row per file, with its name, path or size, to a file, a table or a tMap.

Les lignes partent après la boucleThe rows leave after the loop

Pendant la boucle, chaque ligne est seulement gardée en mémoire (dans globalMap). Le flux Main démarre quand le sous-job de la boucle est fini, comme après un On Subjob Ok. Dans le code généré, le composant est remplacé par deux autres : tIterateToFlowOut, qui range les lignes, et un tArrayIn, qui les envoie. During the loop, each row is only kept in memory (in globalMap). The Main flow starts when the loop subjob is over, as after an On Subjob Ok. In the generated code, the component is replaced with two others: tIterateToFlowOut, which stores the rows, and a tArrayIn, which sends them.

  1. Déposez le tIterateToFlow depuis la famille Orchestration de la palette, et reliez-lui le composant qui itère (clic droit › Ligne › Iterate). Drop the tIterateToFlow from the Orchestration family of the palette, and connect the iterating component to it (right-click › Row › Iterate).
  2. Définissez son schéma : une colonne par valeur à garder. Chaque colonne reçoit une ligne dans le tableau Mapping. Define its schema: one column per value to keep. Each column gets a line in the Mapping table.
  3. Dans Mapping, donnez pour chaque colonne une expression Java, par exemple ((String) globalMap.get("tFileList_1_CURRENT_FILE")), puis reliez la sortie Main au composant suivant. In Mapping, give each column a Java expression, for example ((String) globalMap.get("tFileList_1_CURRENT_FILE")), then connect the Main output to the next component.

ParamètresSettings

Le nom technique, en gris, est celui du paramètre dans le fichier du job. The technical name, in grey, is the parameter name in the job file.

ParamètreSetting DéfautDefault OngletTab Description
SchémaSchemaSCHEMA videempty Paramètres simplesBasic settings Les colonnes des lignes produites, envoyées dans le flux Main. The columns of the rows produced, sent in the Main flow.
MappingMAPPING · VALUE videempty Paramètres simplesBasic settings Une ligne par colonne du schéma. Sa Valeur est une expression Java du type de la colonne, calculée à chaque itération : une variable globale, une variable de contexte, un calcul. One line per schema column. Its Value is a Java expression of the column type, computed at each iteration: a global variable, a context variable, a computation.

Le composant n'a pas de paramètres avancés propres, ni de variable globale. The component has no advanced settings of its own, and no global variable.

ExemplesExamples

Les sorties sont celles de la console, copiées depuis une exécution du job. The outputs are the console ones, copied from a run of the job.

Les fichiers CSV d'un dossierThe CSV files of a folder

Iterate row1 (Main) tFileList_1 tIterateToFlow_1 tLogRow_1

tFileList : masque "*.csv", sous-répertoires inclus. Schéma du tIterateToFlow : file (String), size (Long). tLogRow en mode Table. tFileList: "*.csv" mask, subdirectories included. tIterateToFlow schema: file (String), size (Long). tLogRow in Table mode.

ColonneColumn Valeur (Mapping)Value (Mapping)
file((String) globalMap.get("tFileList_1_CURRENT_FILE"))
sizenew java.io.File((String) globalMap.get("tFileList_1_CURRENT_FILEPATH")).length()
.------------------+----.
|       tLogRow_1       |
|=-----------------+---=|
|file              |size|
|=-----------------+---=|
|orders_2025-12.csv|25  |
|orders_2026-01.csv|21  |
|orders_2026-02.csv|15  |
'------------------+----'

Les lignes arrivent après la boucleThe rows arrive after the loop

Iterate Iterate row1 (Main) tLoop_1 tJava_1 tIterateToFlow_1 tLogRow_1

tLoop de 1 à 3. tJava_1 affiche le tour ; le tIterateToFlow a le schéma value, square (Integer). tLogRow en mode Simple. tLoop from 1 to 3. tJava_1 prints the turn; the tIterateToFlow has the schema value, square (Integer). tLogRow in Basic mode.

// tJava_1
System.out.println("Iteration "
    + ((Integer) globalMap.get("tLoop_1_CURRENT_VALUE")));
ColonneColumn Valeur (Mapping)Value (Mapping)
value((Integer) globalMap.get("tLoop_1_CURRENT_VALUE"))
square((Integer) globalMap.get("tLoop_1_CURRENT_VALUE")) * ((Integer) globalMap.get("tLoop_1_CURRENT_VALUE"))
Iteration 1
Iteration 2
Iteration 3
1|1
2|4
3|9

Les trois tours d'abord, puis les trois lignes : le tLogRow ne reçoit rien pendant la boucle. The three turns first, then the three rows: the tLogRow receives nothing during the loop.

Conseils et limitesTips and limits

Toutes les lignes en mémoireAll the rows in memory

Les lignes sont gardées jusqu'à la fin de la boucle : la mémoire du job grandit avec le nombre de tours, et rien n'arrive au composant suivant avant la fin. Pour un très grand nombre d'itérations, traitez chaque élément dans la boucle plutôt qu'après. The rows are kept until the end of the loop: the job memory grows with the number of turns, and nothing reaches the next component before the end. For a very large number of iterations, process each item inside the loop rather than after it.

Le type de chaque expressionThe type of each expression

globalMap.get renvoie un Object : convertissez-le dans le type de la colonne, (String) ou (Integer). Une valeur long, comme File.length(), va dans une colonne Long. globalMap.get returns an Object: cast it to the column type, (String) or (Integer). A long value, like File.length(), goes into a Long column.

L'inverse : tFlowToIterateThe reverse: tFlowToIterate

Pour exécuter des composants une fois par ligne d'un flux, avec les valeurs de la ligne en variables globales, prenez un tFlowToIterate. To run components once per row of a flow, with the row values as global variables, take a tFlowToIterate.

Une ligne fixe, sans boucleA fixed row, without a loop

Sans boucle, le tIterateToFlow ne sert pas : il lui faut un lien Iterate en entrée. Pour une ou quelques lignes fixes, un tFixedFlowInput suffit. Without a loop, the tIterateToFlow is of no use: it needs an Iterate input link. For one or a few fixed rows, a tFixedFlowInput is enough.

Voir aussiSee also