Search code examples
pentahopentaho-data-integrationpdi

PDI Subtract 1 Min from system date variable


I'm trying to use PDI to subtract 1min or 60seconds from the default system date (variable). I have this command connected to a calcuator step. But it either gives me an error or NO time value

2020/04/20 11:51:00 - Calculator.0 - ERROR (version 9.0.0.0-423, build 9.0.0.0-423 from 2020-01-31 04.53.04 by buildguy) : Unexpected error
2020/04/20 11:51:00 - Calculator.0 - ERROR (version 9.0.0.0-423, build 9.0.0.0-423 from 2020-01-31 04.53.04 by buildguy) : org.pentaho.di.core.exception.KettleStepException: 
2020/04/20 11:51:00 - Calculator.0 - Unable to find the second argument field 'test for calculation #1
2020/04/20 11:51:00 - Calculator.0 - 
2020/04/20 11:51:00 - Calculator.0 -    at org.pentaho.di.trans.steps.calculator.Calculator.processRow(Calculator.java:133)
2020/04/20 11:51:00 - Calculator.0 -    at org.pentaho.di.trans.step.RunThread.run(RunThread.java:62)
2020/04/20 11:51:00 - Calculator.0 -    at java.lang.Thread.run(Thread.java:748)

enter image description here


Solution

  • That calculation expects a fieldname, not a static value.

    You can fix this by first using another calculation, "set field to constant value A". That one does accept a value in column FieldA. Give it a name (sixty_seconds), a value (60) and use that as the Field B for your real calculation.

    Set Remove? to Y for the first calculation so that it doesn't get added to the output rows.