1

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

Tony
  • 8,681
  • 7
  • 36
  • 55

2 Answers2

2

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.

Cyrus
  • 2,135
  • 2
  • 11
  • 14
0

use Modified Java Script Value

enter image description here

MyTime is a fixed system date. need to add below code snippet

var MyNewTime;

MyNewTime = MyTime.setMinutes(MyTime.getMinutes());
MyNewTime = new Date(MyTime);
MyNewTime.setMinutes(MyTime.getMinutes() - 1);
Jay Kakadiya
  • 501
  • 1
  • 5
  • 12