# Problems insert query

**URL:** <https://forum.inductiveautomation.com/t/problems-insert-query/4221>\
**Category:** Ignition\
**Created:** [March 29, 2012, 3:08pm UTC](https://forum.inductiveautomation.com/t/problems-insert-query/4221 "2012-03-29T15:08:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![SamJaimes](https://avatars.discourse-cdn.com/v4/letter/s/a6a055/32.png) [@SamJaimes](https://forum.inductiveautomation.com/u/SamJaimes)\
**Post date:** [March 29, 2012, 3:08pm UTC](https://forum.inductiveautomation.com/t/problems-insert-query/4221/1 "2012-03-29T15:08:53Z")

</div>

Hello everybody!

I’m trying to do an Insert query using:

```auto
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? ❓

Thanks for your help! ![:prayer:](https://us1.discourse-cdn.com/inductiveautomation/original/1X/e5a7e3b63facc151ea73e3b45db7bdb3d4bdc316.gif ":prayer:")

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [March 29, 2012, 3:19pm UTC](https://forum.inductiveautomation.com/t/problems-insert-query/4221/2 "2012-03-29T15:19:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![SamJaimes](https://avatars.discourse-cdn.com/v4/letter/s/a6a055/32.png) [@SamJaimes](https://forum.inductiveautomation.com/u/SamJaimes)\
**Post date:** [March 29, 2012, 3:50pm UTC](https://forum.inductiveautomation.com/t/problems-insert-query/4221/3 "2012-03-29T15:50:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [March 29, 2012, 4:12pm UTC](https://forum.inductiveautomation.com/t/problems-insert-query/4221/4 "2012-03-29T16:12:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![SamJaimes](https://avatars.discourse-cdn.com/v4/letter/s/a6a055/32.png) [@SamJaimes](https://forum.inductiveautomation.com/u/SamJaimes)\
**Post date:** [April 10, 2012, 11:13am UTC](https://forum.inductiveautomation.com/t/problems-insert-query/4221/5 "2012-04-10T11:13:51Z")

</div>

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:](https://us1.discourse-cdn.com/inductiveautomation/original/1X/76d1620bec252bfac07050c889ff5a91dc8a9c25.gif ":scratch:")

Thanks for your help!
