I've got this doubt about Pentaho set variable step. This is my ktr configuration:
I'm checking if there are bad records to report. I'm using a sequence to keep the count. After that I'm preparing a document with this errors to be sent just it the counter is greater than zero.
For the kjb father I am using this configutation to check the quantity of errors:
However when I execute the process, for the ktr I'm getting this message:
Set Variables 2.0 - Set variable NumberOfErrors to value 1 org.pentaho.di.core.exception.KettleStepException: Only 1 input row was expected to set the variables and at least 2 were received. at org.pentaho.di.trans.steps.setvariable.SetVariable.processRow(SetVariable.java:96) at org.pentaho.di.trans.step.RunThread.run(RunThread.java:62) at java.lang.Thread.run(Thread.java:748) 2019/02/04 18:56:36 - Set Variables 2.0 - ERROR (version 8.1.0.0-365, build 8.1.0.0-365 from 2018-04-30 09.42.24 by buildguy) : Unexpected error 2019/02/04 18:56:36 - Set Variables 2.0 - ERROR (version 8.1.0.0-365, build 8.1.0.0-365 from 2018-04-30 09.42.24 by buildguy) : org.pentaho.di.core.exception.KettleStepException: 2019/02/04 18:56:36 - Set Variables 2.0 - Only 1 input row was expected to set the variables and at least 2 were received. 2019/02/04 18:56:36 - Set Variables 2.0 - 2019/02/04 18:56:36 - Set Variables 2.0 - at org.pentaho.di.trans.steps.setvariable.SetVariable.processRow(SetVariable.java:96) 2019/02/04 18:56:36 - Set Variables 2.0 - at org.pentaho.di.trans.step.RunThread.run(RunThread.java:62) 2019/02/04 18:56:36 - Set Variables 2.0 - at java.lang.Thread.run(Thread.java:748)
And the variable with the errors is equal to zero even when I know that there are some bad records.
How can I configure the set variable step in the proper way in order to set the value of this variable?
Regards.
The error that you are seeing is telling you that Set Variables step only accepts streams containing a single row.
In case your stream contains many rows this step will throw an error.
To solve your issue you could try aggregating the rows using Group By step so that you can aggregate all your rows into a single one which is containing the count field.
After that your Set Variables step will receive only 1 input row and the variable will be successfully set in the parent job.