How to conditionally execute something based on previous processed number of rows?

StackOverflow https://stackoverflow.com/questions/22669993

  •  22-06-2023
  •  | 
  •  

Question

I want to execute some subjob if the previously processed number of rows are greater than N. To do this, i'm using the following configuration:

enter image description here

tFixedFlowInput have some rows. tAggregateRow uses the count function and outputs one row with the number. tSetGlobalVar then stores this value into a global var that I can check in the Run If connector (In this case, (Integer)globalMap.get("tSetGlobalVar_1") > 3 ). tMsgBox then shows if the condition is true.

What I would like is to do the same, but in a more elegant way, using the minimum components required. I would like to connect tAggregateRow with the Run If connector directly (or even tFixedFlow) with tMsgBox, but I haven't found a way to refer to the number of rows previously processed without using the output row2.count variable.

How could I do something like this?

enter image description here

What should I put in the If condition to refer to the tAggregateRow operation result without connecting it to another meaningless component like exposed at the beginning?

Was it helpful?

Solution

for any talend component look under outline tab under the left side workspace pane at the bottom. this lists down the properties available via global variables for that component. Some properties like count of records inserted by output components are only available once the component is executed completely (After).

for your case you can try directly using ((Integer)globalMap.get("tFixedFlowInput_1_NB_LINE")) which gives number of lines (after) given by tFixedFlowInput. enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top