У меня есть поле Integer
с именем year
, что неудивительно, что содержит текущий год:
2019
Я хочу извлечь последнюю цифру года.В этом случае, 9
, результатом будет String
(одиночный символ).
Я пробовал User defined Java Expression
следующим образом:
Integer.toString(year).substring(Integer.toString(year).length() - 1)
Но это даетошибка включена ниже. Как я могу получить последнюю цифру года?
2019/02/14 09:43:38 - Get last digit of month.0 - ERROR (version 8.2.0.0-342, build 8.2.0.0-342 from 2018-11-14 10.30.55 by buildguy) : Unexpected error
2019/02/14 09:43:38 - Get last digit of month.0 - ERROR (version 8.2.0.0-342, build 8.2.0.0-342 from 2018-11-14 10.30.55 by buildguy) : org.pentaho.di.core.exception.KettleException:
2019/02/14 09:43:38 - Get last digit of month.0 - org.pentaho.di.core.exception.KettleValueException:
2019/02/14 09:43:38 - Get last digit of month.0 - org.codehaus.janino.CompileException: Line 1, Column 17: No applicable constructor/method found for actual parameters "java.lang.Long"; candidates are: "java.lang.String java.lang.Integer.toString(int, int)", "java.lang.String java.lang.Integer.toString()", "java.lang.String java.lang.Integer.toString(int)", "java.lang.String java.lang.Object.toString()", "java.lang.String java.lang.Object.toString()", "java.lang.String java.lang.Object.toString()"
2019/02/14 09:43:38 - Get last digit of month.0 - Line 1, Column 17: No applicable constructor/method found for actual parameters "java.lang.Long"; candidates are: "java.lang.String java.lang.Integer.toString(int, int)", "java.lang.String java.lang.Integer.toString()", "java.lang.String java.lang.Integer.toString(int)", "java.lang.String java.lang.Object.toString()", "java.lang.String java.lang.Object.toString()", "java.lang.String java.lang.Object.toString()"
2019/02/14 09:43:38 - Get last digit of month.0 -
2019/02/14 09:43:38 - Get last digit of month.0 -
2019/02/14 09:43:38 - Get last digit of month.0 - org.codehaus.janino.CompileException: Line 1, Column 17: No applicable constructor/method found for actual parameters "java.lang.Long"; candidates are: "java.lang.String java.lang.Integer.toString(int, int)", "java.lang.String java.lang.Integer.toString()", "java.lang.String java.lang.Integer.toString(int)", "java.lang.String java.lang.Object.toString()", "java.lang.String java.lang.Object.toString()", "java.lang.String java.lang.Object.toString()"
2019/02/14 09:43:38 - Get last digit of month.0 - Line 1, Column 17: No applicable constructor/method found for actual parameters "java.lang.Long"; candidates are: "java.lang.String java.lang.Integer.toString(int, int)", "java.lang.String java.lang.Integer.toString()", "java.lang.String java.lang.Integer.toString(int)", "java.lang.String java.lang.Object.toString()", "java.lang.String java.lang.Object.toString()", "java.lang.String java.lang.Object.toString()"
2019/02/14 09:43:38 - Get last digit of month.0 -
2019/02/14 09:43:38 - Get last digit of month.0 -
2019/02/14 09:43:38 - Get last digit of month.0 - at org.pentaho.di.trans.steps.janino.Janino.processRow(Janino.java:113)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.pentaho.di.trans.step.RunThread.run(RunThread.java:62)
2019/02/14 09:43:38 - Get last digit of month.0 - at java.lang.Thread.run(Unknown Source)
2019/02/14 09:43:38 - Get last digit of month.0 - Caused by: org.pentaho.di.core.exception.KettleValueException:
2019/02/14 09:43:38 - Get last digit of month.0 - org.codehaus.janino.CompileException: Line 1, Column 17: No applicable constructor/method found for actual parameters "java.lang.Long"; candidates are: "java.lang.String java.lang.Integer.toString(int, int)", "java.lang.String java.lang.Integer.toString()", "java.lang.String java.lang.Integer.toString(int)", "java.lang.String java.lang.Object.toString()", "java.lang.String java.lang.Object.toString()", "java.lang.String java.lang.Object.toString()"
2019/02/14 09:43:38 - Get last digit of month.0 - Line 1, Column 17: No applicable constructor/method found for actual parameters "java.lang.Long"; candidates are: "java.lang.String java.lang.Integer.toString(int, int)", "java.lang.String java.lang.Integer.toString()", "java.lang.String java.lang.Integer.toString(int)", "java.lang.String java.lang.Object.toString()", "java.lang.String java.lang.Object.toString()", "java.lang.String java.lang.Object.toString()"
2019/02/14 09:43:38 - Get last digit of month.0 -
2019/02/14 09:43:38 - Get last digit of month.0 - at org.pentaho.di.trans.steps.janino.Janino.calcFields(Janino.java:220)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.pentaho.di.trans.steps.janino.Janino.processRow(Janino.java:104)
2019/02/14 09:43:38 - Get last digit of month.0 - ... 2 more
2019/02/14 09:43:38 - Get last digit of month.0 - Caused by: org.codehaus.janino.CompileException: Line 1, Column 17: No applicable constructor/method found for actual parameters "java.lang.Long"; candidates are: "java.lang.String java.lang.Integer.toString(int, int)", "java.lang.String java.lang.Integer.toString()", "java.lang.String java.lang.Integer.toString(int)", "java.lang.String java.lang.Object.toString()", "java.lang.String java.lang.Object.toString()", "java.lang.String java.lang.Object.toString()"
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.UnitCompiler.compileError(UnitCompiler.java:8185)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.UnitCompiler.findMostSpecificIInvocable(UnitCompiler.java:6052)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.UnitCompiler.findIMethod(UnitCompiler.java:5923)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.UnitCompiler.findIMethod(UnitCompiler.java:5862)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.UnitCompiler.getType2(UnitCompiler.java:4424)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.UnitCompiler.access$11400(UnitCompiler.java:108)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.UnitCompiler$16.visitMethodInvocation(UnitCompiler.java:4066)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.Java$MethodInvocation.accept(Java.java:2649)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.UnitCompiler.getType(UnitCompiler.java:4086)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.UnitCompiler.findIMethod(UnitCompiler.java:5862)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.UnitCompiler.getType2(UnitCompiler.java:4424)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.UnitCompiler.access$11400(UnitCompiler.java:108)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.UnitCompiler$16.visitMethodInvocation(UnitCompiler.java:4066)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.Java$MethodInvocation.accept(Java.java:2649)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.UnitCompiler.getType(UnitCompiler.java:4086)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.UnitCompiler.findMostSpecificIInvocable(UnitCompiler.java:6028)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.UnitCompiler.findIMethod(UnitCompiler.java:5923)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.UnitCompiler.findIMethod(UnitCompiler.java:5862)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:3124)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.UnitCompiler.access$6300(UnitCompiler.java:108)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.UnitCompiler$10.visitMethodInvocation(UnitCompiler.java:2579)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.Java$MethodInvocation.accept(Java.java:2650)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:2599)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:3535)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:1439)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.UnitCompiler.access$1700(UnitCompiler.java:108)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.UnitCompiler$4.visitReturnStatement(UnitCompiler.java:748)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.Java$ReturnStatement.accept(Java.java:1665)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:758)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:777)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.UnitCompiler.access$700(UnitCompiler.java:108)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.UnitCompiler$4.visitBlock(UnitCompiler.java:738)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.Java$Block.accept(Java.java:1280)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:758)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:1783)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:723)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:705)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:431)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:329)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.UnitCompiler$3.visitPackageMemberClassDeclaration(UnitCompiler.java:302)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.Java$PackageMemberClassDeclaration.accept(Java.java:703)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:308)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.UnitCompiler.compileUnit(UnitCompiler.java:286)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.SimpleCompiler.compileToClassLoader(SimpleCompiler.java:420)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.ClassBodyEvaluator.compileToClass(ClassBodyEvaluator.java:400)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.ScriptEvaluator.cook(ScriptEvaluator.java:607)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.ScriptEvaluator.cook(ScriptEvaluator.java:443)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.Cookable.cook(Cookable.java:72)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.Cookable.cook(Cookable.java:64)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.codehaus.janino.Cookable.cook(Cookable.java:114)
2019/02/14 09:43:38 - Get last digit of month.0 - at org.pentaho.di.trans.steps.janino.Janino.calcFields(Janino.java:171)
2019/02/14 09:43:38 - Get last digit of month.0 - ... 3 more