Problems insert query

Hello everybody!

I’m trying to do an Insert query using:

idTabla = event.source.parent.idTablaMax
idTipoConsigna = event.source.parent.getComponent('cmbTipoConsigna').selectedValue
inicioTramo = event.source.parent.getComponent('txtInicioTramo').intValue
finTramo = event.source.parent.getComponent('txtFinTramo').intValue
cantidad = event.source.parent.getComponent('txtCantidad').intValue

if idTipoConsigna <= 0:
  system.gui.messageBox ("Por favor, introduzca un Tipo de Consigna")
else:
  system.db.runPrepUpdate("INSERT INTO precio (idTabla, cantidad, inicioTramo, finTramo, Instalacion_idTabla, TipoConsigna_idTabla) VALUES (?,?,?,?,?,?)", [idTabla, cantidad, inicioTramo, finTramo, '1', idTipoConsigna])

The arguments come from 3 numeric text field and my problem is that when I execute this script it doesn’t I enter the numeric text field values correctly. Does anybody know why this happen? :question:

Thanks for your help! :prayer:

What do you mean it doesn’t enter the values correctly? Do you get an error? Can you provide a little more information?

Of course, the problem is if the default values are 0,0,0 and I enter 4,5,8 in the numeric text field the query write in the database something like 4,5,0 instead.

Ok, well you should put a print out right above the insert query:print idTabla, cantidad, inicioTramo, finTramo, '1', idTipoConsignato see what the values are so you can trace it back.

I did it and I could see the problem was because the component “numeric text field” didn’t captured the values correctly, so I changed the the numeric text field for text field and the problem disappeared. :scratch:

Thanks for your help!