FPMI code error message when pressing button

I have a button that has some code underneath it. Also in the root container where this button is located I have a dynamic property.

The name of the dynamic property in the root container is : prod_date

The code i have is as follows:

if event.source.parent.prod_date == 0: fpmi.db.runUpdateQuery(.........) else: fpmi.gui.messageBox(.....)

When I run this code I get the following message:

[quote]Traceback (innermost last):
File “event:actionPerformed”, line 32, in ?
AttributeError: instance of ‘com.inductiveautomation.factorypmi.application.components.BasicContainer’ has no attribute ‘prod_date’

at org.python.core.Py.AttributeError(Py.java)
at org.python.core.PyObject.__getattr__(PyObject.java)
at org.python.pycode._pyx24.f$0(<event:actionPerformed>:32)
at org.python.pycode._pyx24.call_function(<event:actionPerformed>)
at org.python.core.PyTableCode.call(PyTableCode.java)
at org.python.core.PyCode.call(PyCode.java)
at org.python.core.Py.runCode(Py.java)
at com.inductiveautomation.factorypmi.application.script.ScriptManager.runCode(ScriptManager.java:245)
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.runActions(ActionAdapter.java:145)
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.invoke(ActionAdapter.java:287)
at com.inductiveautomation.factorypmi.application.binding.action.RelayInvocationHandler.invoke(RelayInvocationHandler.java:57)
at $Proxy0.actionPerformed(Unknown Source)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(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 java.awt.EventDispatchThread.run(Unknown Source)


Can you explain to me why it is saying there is no attribute?

Thanks and have a great day.

Well, everything looks right from your description. Variable names are case sensitive - are you sure its “prod_date” and not “Prod_Date” or something like that?

Yes I am sure about the code and the name, I have even went thru and using the linking chains have redone the code just to make sure. I have tried both the linking chains and also hand typing it. But both come up with the same error message. It is a new one that I dont understand.

Any other ideas or suggestions?


Also make sure that the button is directly on the root container, not in a sub container. What version are you running?

On the page in question there is only one container and the button is in that container and it is the root. So for this I am sure.

As for the version I am running, If I understand correct you just released a new version of PMI, If that is indeed the case then I am one step back from the current.

Hope this helps.

Can you export the window in question and post it here?