1

Probably, there is an easy solution -- I just can't find it:

In a kettle transformation rows are read from some DB table, passed on through some filtering steps and finally written to some other DB table. The filtering steps eliminate non-matching rows.

In this process, I want to count both "good" and "bad" rows and pass those two results to a calling job to send out an email like

<n> rows in total (<g> good / <b> bad)

PS: Using global variables and increasing them in JavaScript-Steps does not work ... (multi-threading?)

SirZ
  • 13
  • 4

1 Answers1

1

You can calculate the number of rows in each branch using GroupBy step and "Number of rows (without field argument)" aggregate, then you can set variables as needed using these calculated values.

xkavator
  • 376
  • 2
  • 4
  • Thank you for providing this super helpful hint! – SirZ Aug 03 '17 at 08:06
  • For other Kettle beginners: The `group by`-step must not use any "group fields" for this kind of aggregation. – SirZ Aug 03 '17 at 08:06
  • A side note: If the rows you want to count in the group by node are all **null**, select Type as "Number of rows (without field argument)", you can't use "Number of Values (N)" option. You just can't. – gdrt Jun 25 '19 at 12:51