Bonita MySQL Insert Statement

Hi @all,

i am connected to a mysql database and want to make an insert statement via the mysql connector. For the query i am using the query window of the mysql connector configuration.
My query looks like this:
INSERT INTO table
(test, test2, test3, test4)
VALUES (‘${var}’, NULL, NULL, ${var});

Unfortunately when i am testing this insert statement in the connector configuration, bonita always shows an error: "Input parameter ‘script’ uses an expression with an not invocable reference.
The Syntax should be ok. The variables are defined globally with a default value. The connection to the database is ok and inserts without referenced values are possible. The referenced variables are typed in with the code completion to avoid typing mistakes.

So where is the mistake?

Bonita Version: 6.3.6

Hi, sorry for my english.

You should change the editor to create a condition, and edit a script, like the follow code:

def campo=“”
campo= “insert into det_requi(codigo, descripcion, cantidad, unidad, num_requi)” +
" values(‘“+f_codigo+”’, ‘“+f_descripcion+”’, ‘“+f_cantidad+”’, ‘“+f_unidad+”’, ‘“+idrequi+”’)"**

I hope that this code help you

Agustín

Hello jhone!

Sometimes Bonita maintains a reference on a variable that is already deleted. Make a try on creating a simple process from the scratch with the same variables and a mysql connector just to check this.
Your statement seems to be right and the steps you described are ok too. Post a print screen on the Bonita popup and the log associated, if any is given.

Cheers,
Marcos Vinícius Pinto
MXM Sistemas
Brasil

Hola a todos requiero ayuda estoy trabajando con la conexión a Mysql como puedo realizar una condición de búsqueda por cédula de identidad si en esta caso en la base de datos ya existe que me permita pasar a otra tarea para realizar un método en este caso de insert un nuevo registro.
Por favor que alguien me ayude.

Hi arodriguezmba,

thank you for your fast suggestion. Now i changed the editor and used following lines
in the Groovy Script:

def insert= "" insert = "INSERT INTO det_requi (test, testinteger)" + " VALUES('"+referenced_var1+"', '"+referenced_var2+"')"

But bonita pops up again an error window: "Input parameter ‘script’ uses an expression with a not invocable reference.

Jonas

Any suggestions? Problem is still not solved.

Hi marco.pinto,

thanks for your suggestion. I solved this problem this way:
I downloaded the latest Bonita Version. Then i made my Insert Statement like described above.
Then i tested the Statement in the Configuration Window. Unfortunately the same error pops up. But then i checked the log files und no error was displayed. Thus the data was saved into my database. (Awesome).

So i have one hint for those who have the same problem. **Don’t ** test your Insert Statements in the Configuration Window if you use referenced bonita variables.

Hello jhone!

Sorry, but I didn’t noticed that you were “testing” in the script/connector window. Indeed this “test” does not recognize variables (any type). You need to test only with values (a fault from Bonita, in my opinion).

Cheers!
Marcos Vinícius Pinto
MXM Sistemas
Brasil