# Error on Button Script

**URL:** <https://forum.inductiveautomation.com/t/error-on-button-script/20507>\
**Category:** Ignition\
**Created:** [November 2, 2018, 9:39pm UTC](https://forum.inductiveautomation.com/t/error-on-button-script/20507 "2018-11-02T21:39:32Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![marias](https://avatars.discourse-cdn.com/v4/letter/m/cc9497/32.png) [@marias](https://forum.inductiveautomation.com/u/marias)\
**Post date:** [November 2, 2018, 9:39pm UTC](https://forum.inductiveautomation.com/t/error-on-button-script/20507/1 "2018-11-02T21:39:32Z")

</div>

Hello  
I have an issue with the script for a button.  
I am creating a form to capture data and save it to a Data Base, but I have an error with the script for the button. Already tested the query and it works.  
This is my code:

> # Grab the Data from the components added to the window.

> Tecnico = event.source.parent.getComponent('Numeric Text Field')  
> Fecha = event.source.parent.getComponent('Popup Calendar')  
> Comentario = event.source.parent.getComponent('Text Area')  
> Spare\_Parts = event.source.parent.getComponent('Text Area 1')  
> Tiempo = event.source.parent.getComponent('Numeric Text Field 2')  
> Resultado = event.source.parent.getComponent('Numeric Text Field 1')

> # call to the Named Query, inserting the parameters.
> 
> system.db.runNamedQuery("Insert data", {"Tecnico":Tecnico, "Fecha":Fecha, "Comentario":Comentario, "Spare\_Parts":Spare\_Parts, "Tiempo":Tiempo, "Resultado":Resultado})

And the error I am seeing when I hit the button to save the information is this:

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/8/85ae70a7407b4d025342c084cd6dcdca907ba161.png)

> Traceback (most recent call last):

> File "event:actionPerformed", line 15, in

> com.inductiveautomation.ignition.client.gateway\_interface.GatewayException: com.inductiveautomation.ignition.client.gateway\_interface.GatewayException: Error serializing parameters.

> caused by GatewayException: Error serializing parameters.  
> caused by NotSerializableException: com.inductiveautomation.ignition.common.gui.border.FieldBorder

I appreciate your help.  
Thank you.

---

<div class="post-metadata">

**Author:** ![mrogers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mrogers/32/4110_2.png) [@mrogers](https://forum.inductiveautomation.com/u/mrogers)\
**Post date:** [November 2, 2018, 9:45pm UTC](https://forum.inductiveautomation.com/t/error-on-button-script/20507/2 "2018-11-02T21:45:21Z")

</div>

The problem is you’re sending the objects themselves as parameters to the query. Try something like Comentario.text, Spare\_Parts.text, Tiempo.intValue etc.

---

<div class="post-metadata">

**Author:** ![marias](https://avatars.discourse-cdn.com/v4/letter/m/cc9497/32.png) [@marias](https://forum.inductiveautomation.com/u/marias)\
**Post date:** [November 5, 2018, 9:49pm UTC](https://forum.inductiveautomation.com/t/error-on-button-script/20507/3 "2018-11-05T21:49:50Z")

</div>

I changed my code trying to follow the user manual [Inserting data into database](https://docs.inductiveautomation.com/display/DOC79/Inserting+Data+into+a+Database), but can’t find what I am doing wrong.

This is how I changed it:

```auto
> # Grab the Data from the components added to the window.

> Tecnico = event.source.parent.getComponent('Numeric Text Field').IntegerValue
> Fecha = event.source.parent.getComponent('Popup Calendar').date
> Comentario = event.source.parent.getComponent('Text Area').Text
> Spare_Parts = event.source.parent.getComponent('Text Area 1').Text
> Tiempo = event.source.parent.getComponent('Numeric Text Field 2').FloatValue
> Resultado = event.source.parent.getComponent('Numeric Text Field 1').IntegerValue
>  
> # A call to the Named Query, inserting the parameters.
> system.db.runNamedQuery("Insert data", 
> {"Tecnico":Tecnico, "Fecha":Fecha, "Comentario":Comentario, "Spare_Parts":Spare_Parts, "Tiempo":Tiempo, "Resultado":Resultado})

```

Any Idea what could be wrong?

I appreciate the help

---

<div class="post-metadata">

**Author:** ![ethomason](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ethomason/32/43338_2.png) [@ethomason](https://forum.inductiveautomation.com/u/ethomason)\
**Post date:** [November 5, 2018, 9:51pm UTC](https://forum.inductiveautomation.com/t/error-on-button-script/20507/4 "2018-11-05T21:51:10Z")

</div>

What’s the new error?

---

<div class="post-metadata">

**Author:** ![mrogers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mrogers/32/4110_2.png) [@mrogers](https://forum.inductiveautomation.com/u/mrogers)\
**Post date:** [November 5, 2018, 9:52pm UTC](https://forum.inductiveautomation.com/t/error-on-button-script/20507/5 "2018-11-05T21:52:06Z")

</div>

Python is case-sensitive - those ‘Text’ ones should just be ‘text’. ‘IntegerValue’ should be ‘intValue’, things like that. In the property editor you can hover over the name of the property on the left and it will tell you its scripting name. Make sure to use the right capitalization with those and you should be good.

Also, just a note for the code snippet you put in there - use three backticks like ```, before and then again after the code you paste. It formats it better.

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [November 5, 2018, 9:57pm UTC](https://forum.inductiveautomation.com/t/error-on-button-script/20507/6 "2018-11-05T21:57:06Z")

</div>

Just use the Insert Property Reference in the upper right hand corner of the scripting window until you get the hang of it. The icon looks like a chain link

---

<div class="post-metadata">

**Author:** ![marias](https://avatars.discourse-cdn.com/v4/letter/m/cc9497/32.png) [@marias](https://forum.inductiveautomation.com/u/marias)\
**Post date:** [November 5, 2018, 10:18pm UTC](https://forum.inductiveautomation.com/t/error-on-button-script/20507/7 "2018-11-05T22:18:24Z")

</div>

this is the new error

> Traceback (most recent call last):

> File "event:actionPerformed", line 3, in

> AttributeError: '[com.inductiveautomation.factorypmi.application.com](http://com.inductiveautomation.factorypmi.application.com)' object has no attribute 'intvalue'

> Ignition v7.9.9 (b2018081621)  
> Java: Oracle Corporation 1.8.0\_191

---

<div class="post-metadata">

**Author:** ![nick.schuetz](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nick.schuetz/32/6160_2.png) [@nick.schuetz](https://forum.inductiveautomation.com/u/nick.schuetz)\
**Post date:** [November 5, 2018, 10:25pm UTC](https://forum.inductiveautomation.com/t/error-on-button-script/20507/8 "2018-11-05T22:25:11Z")

</div>

I think intvalue should be intValue.  
You can find the list of properties in the user manual,  
[https://docs.inductiveautomation.com/display/DOC79/Numeric+Text+Field](https://docs.inductiveautomation.com/display/DOC79/Numeric+Text+Field)

---

<div class="post-metadata">

**Author:** ![marias](https://avatars.discourse-cdn.com/v4/letter/m/cc9497/32.png) [@marias](https://forum.inductiveautomation.com/u/marias)\
**Post date:** [November 5, 2018, 10:28pm UTC](https://forum.inductiveautomation.com/t/error-on-button-script/20507/9 "2018-11-05T22:28:23Z")

</div>

Yes it was **intValue**. Thank you everyone for your help
