Hello,
I have been trying to create a data entry form in ignition perspective. The issue is that I am getting an attribute error for the source for an onActionPerformed event. I am very confused, for I thought that onActionPerformed inherently knew what the source would be, or it would not be able to execute? I have even tried manually typing in the name of the button where source would go, but this does not work.
I already have a connection built between SQL server management studio with a SQL table built. There are many columns in this table, but I am just trying to have three columns populate at the moment. These three columns are being put into text input boxes, renamed to Maximum, Minimum, or Price. I want the user to press a button and have the data input go to these columns in the SQL table. The button and text inputs are all under the same coordinate container.
Script for Event:
def runAction(self, event):
Maximum = event.source.parent.getComponent('Maximum').text
Minimum = event.source.parent.getComponent('Minimum').text
Price = event.source.parent.getComponent('Price').text
system.db.runNamedQuery('AddNMR', {'Maximum':Maximum, 'Minimum':Minimum, 'Price':Price})
Correlated query:
Error Received:
Error running action 'component.onActionPerformed' on MyVieww/MyView@D/root/TabContainer/CoordinateContainer/Button: Traceback (most recent call last): File "function:runAction", line 2, in runAction AttributeError: 'com.inductiveautomation.ignition.common.script.ada' object has no attribute 'source'
This model was inspired by the back half of this post:
Inserting Data into a Database - Ignition User Manual 8.1 - Ignition Documentation (inductiveautomation.com)
Thanks!