Error convert to int

Hi, I write to you because i have a problem with a numeric text field, i call the window where is the numeric text field, and appears a message with error, after it I close i try once more, and it’s ok i can work with that numeric text field, and it ocurs again if I save de proyect in the designer, or I logout and log in again with another user, or the user. i try again and it works until i save the project again or the other actions.

the message says:

Traceback (most recent call last):

File “event:internalFrameOpened”, line 2, in

TypeError: can’t convert 63.5 to int

Ignition v7.5.1 (b1122)
Java: Sun Microsystems Inc. 1.6.0_31

I can’t understand, because everything is with its respective type integer

I will appreciate you help please what this message means.

Hi caritoel27,

That message normally comes from trying to cast a float to an int.

Can you copy the script from internalFrameOpened and paste it in this thread?

The thing is that i’m not converting from float to int . I’m sending every value for that is a float

Velocidad is the value i’m sending to the numeric text field Temperatura, both float in the BD is also Float(Mysql) y shows me the error 1 time , after it works without message of error.

the error appears if a save a change or only save the project in the designer.

I send you the full message error, 2 pictures one is the parameters that i send when i clic the button to the window add_curva_calibre, the others is the window that contains the button error
also I send the window ADD_punto called if it helps.

the message more detailed
Traceback (most recent call last):
File “event:internalFrameOpened”, line 2, in
TypeError: can’t convert 0.0 to int

at org.python.core.PyException.fillInStackTrace(
at java.lang.Throwable.<init>(
at java.lang.Exception.<init>(Unknown Source)
at java.lang.RuntimeException.<init>(Unknown Source)
at org.python.core.PyException.<init>(
at org.python.core.PyException.<init>(
at org.python.core.PyException.<init>(
at org.python.core.Py.TypeError(
at org.python.core.Py.tojava(
at org.python.core.PyBeanProperty._doset(
at org.python.core.PyObject.__set__(
at org.python.core.PyObject.object___setattr__(
at org.python.core.PyObject.object___setattr__(
at org.python.core.PyObject$object___setattr___exposer.__call__(Unknown Source)
at org.python.core.PyObjectDerived.__setattr__(
at com.inductiveautomation.factorypmi.application.script.PyComponentWrapper.__setattr__(
at org.python.pycode._pyx67.f$0(<event:internalFrameOpened>:2)
at org.python.pycode._pyx67.call_function(<event:internalFrameOpened>)
at org.python.core.Py.runCode(
at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.runActions(
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.invoke(
at com.inductiveautomation.factorypmi.application.binding.action.RelayInvocationHandler.invoke(
at $Proxy19.internalFrameOpened(Unknown Source)
at javax.swing.JInternalFrame.fireInternalFrameEvent(Unknown Source)
at Source)
at Source)
at java.awt.Component.setVisible(Unknown Source)
at javax.swing.JComponent.setVisible(Unknown Source)
at com.inductiveautomation.factorypmi.application.FPMIApp$RuntimeWindowOpener.openWindow(
at com.inductiveautomation.factorypmi.application.FPMIApp.openWindow(
at com.inductiveautomation.factorypmi.application.script.builtin.SecurityUtilities._tempReOpen(
at com.inductiveautomation.factorypmi.application.runtime.UpdateProjectPane.uninstall(
at com.inductiveautomation.factorypmi.application.runtime.UpdateProjectPane$1.stepsFinished(
at com.inductiveautomation.ignition.client.launch.AbstractStepRunner$
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$ Source)
at java.awt.EventQueue$ Source)
at Method)
at$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at Source)

Ignition v7.5.1 (b1122)
Java: Sun Microsystems Inc. 1.6.0_31
AddPunto.proj (17.4 KB)

That internalFrameOpened script needs to be modified to send the proper datatype to that property, since the property is expecting an int. Changing the script so that it takes the float value and casts it as an int should work:

system.gui.getParentWindow(event).getComponentForPath('Root Container.AddEditContainer.Numeric Text Field').intValue = int(system.gui.getParentWindow(event).getComponentForPath('Root Container').Velocidad)

Thanks very much James!!! :smiley: :prayer: it works!!! Have a good day :slight_smile: