Hi Community!
I'm trying to use some groovy code to do an update according to a list. Well, I'm having some bad time, probably because my code have something wrong.
import groovy.sql.Sql
<p> def lista = []</p> <p> Sql sql = BonitaSql.newInstance("jdbc:oracle:thin:@MYIPADRESS:orcl1", "NAME", "PASS",new oracle.jdbc.OracleDriver())<br /> sql.eachRow "SELECT CD_USUARI FROM VULTIMOLOG WHERE DAT < (sysdate - 20)", {lista +=it.CD_USUARI}<br /> sql.close()</p> <p> def Integer n = lista.size();<br /> for (int i=0; i<n; i++)<br /> {<br /> Sql sql2 = BonitaSql.newInstance("jdbc:oracle:thin:@MYIPADRESS:orcl1", "NAME", "PASS",new oracle.jdbc.OracleDriver())<br /> def Integer s1 = lista.getAt(i).get(1)<br /> def query="UPDATE NAME.SIUSUARI SET CH_ATIVO = 'I' WHERE CH_ATIVO ='A' AND &${s1} "<br /> sql2.execute(query);<br /> }<br /> return lista</p>
I keep getting this error:
Exception was:org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: groovy.lang.MissingMethodException: No signature of method: java.math.BigDecimal.get() is applicable for argument types: (java.lang.Integer) values: [1]
Possible solutions: grep(), next(), pow(int), grep(java.lang.Object), getAt(java.lang.String), wait()
Any clues?
TIA.