Hi guys,
i‘ m not sure if I’m right here, I'm very new to Knime and Java.
I have tried to replace the String „36 months“ of my column termLaufzeit3660 with the double 0 and the String „60 months“ with the double 1, with the java snippet. This snipped contains the following code:
/
/ system imports
import org.knime.base.node.jsnippet.expression.AbstractJSnippet;
import org.knime.base.node.jsnippet.expression.Abort;
import org.knime.base.node.jsnippet.expression.Cell;
import org.knime.base.node.jsnippet.expression.ColumnException;
import org.knime.base.node.jsnippet.expression.TypeException;
import static org.knime.base.node.jsnippet.expression.Type.*;
import java.util.Date;
import java.util.Calendar;
import org.w3c.dom.Document;
// Your custom imports:
// system variables
public class JSnippet extends AbstractJSnippet {
// Fields for input columns
/** Input column: "term Laufzeit (36,60)" */
public String c_termLaufzeit3660;
// Fields for output columns
/** Output column: "loan_amnt beantragter Betrag" */
public Double[] out_loan_amntbeantragterBetrag;
// Your custom variables:
// expression start
public void snippet() throws TypeException, ColumnException, Abort {
// Enter your code here:
double out_termLaufzeit3660 = 0;
c_termLaufzeit3660.replace("36 months", "0");
c_termLaufzeit3660.replace("60 months", "1");
out_termLaufzeit3660 = Double.parseDouble(c_termLaufzeit3660);
System.out.println(out_termLaufzeit3660);
// expression end
But for every line I get the following error message:
Evaluation of java snippet failed for row "1077501".
The exception is caused by line 35 of the snippet. Exception message:For input string: "36 months"
WARN Java Snippet 0:48 Evaluation of java snippet failed for row "1077430". The exception is caused by line 35 of the snippet. Exception message:For input string: "60 months"
In line 35 is located the following statement:
out_termLaufzeit3660 = Double.parseDouble(c_termLaufzeit3660);
Can someone please help me
Thanks,
Jo