Icon

kn_​example_​java_​simple_​if_​else_​with_​string_​conversion

KNIME and Java - simple if then else - with some string conversion
KNIME and Java - simple if then else - with some string conversionhttps://forum.knime.com/t/java-snipped-simple-if-else/26337/3?u=mlauber71 // make the incoming Flow Variable into a Java variabledouble v_input_factor;v_input_factor = $${Dinput_factor}$$;// convert the double Java variable into a string to use in the code// https://www.journaldev.com/18380/java-convert-double-to-stringString v_input_factor_string = new StringBuilder().append(v_input_factor).toString();// capture a possible problem with null values - if not the code might crashif($var1$ == null) { return "missing";}else if ($var1$ > v_input_factor) {return ">" + v_input_factor_string;}else if ($var1$ <= v_input_factor) {return "<= " + v_input_factor_string;}else {return "something else";} https://www.journaldev.com/18380/java-convert-double-to-string original datainput_factordefault = 7if elsecondition Table Creator Double Input Java Snippet(simple) KNIME and Java - simple if then else - with some string conversionhttps://forum.knime.com/t/java-snipped-simple-if-else/26337/3?u=mlauber71 // make the incoming Flow Variable into a Java variabledouble v_input_factor;v_input_factor = $${Dinput_factor}$$;// convert the double Java variable into a string to use in the code// https://www.journaldev.com/18380/java-convert-double-to-stringString v_input_factor_string = new StringBuilder().append(v_input_factor).toString();// capture a possible problem with null values - if not the code might crashif($var1$ == null) { return "missing";}else if ($var1$ > v_input_factor) {return ">" + v_input_factor_string;}else if ($var1$ <= v_input_factor) {return "<= " + v_input_factor_string;}else {return "something else";} https://www.journaldev.com/18380/java-convert-double-to-string original datainput_factordefault = 7if elsecondition Table Creator Double Input Java Snippet(simple)

Nodes

Extensions

Links