Error on Button Script

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:

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.

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.

I changed my code trying to follow the user manual Inserting data into database, but can’t find what I am doing wrong.

This is how I changed it:

> # 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

What’s the new error?

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.

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

this is the new error

Traceback (most recent call last):

File "event:actionPerformed", line 3, in

AttributeError: 'com.inductiveautomation.factorypmi.application.com' object has no attribute 'intvalue'

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

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

Yes it was intValue . Thank you everyone for your help