Hello,
I want to send tags from my controller to Agent when after a button clique.
I am trying to use the SDK, but i got an error.
Here is my code:
def runAction(self, event):
from com.inductiveautomation.ignition.gateway import IgnitionGateway
from com.inductiveautomation.ignition.gateway.tasks import ScheduleMode
from com.inductiveautomation.ignition.gateway.tasks import TaskSettings
from com.inductiveautomation.ignition.gateway.tasks import GatewayTaskRecord
gatewayContext = IgnitionGateway.get()
taskManager = gatewayContext.getTaskManager()
settings = taskManager.createNewTask("eam", "sendTags")
record = settings.getTaskRecord()
record.setName("Send KPI To Agent")
record.setOwnerId("eam")
record.setMode(ScheduleMode.OnDemand)
record.setTaskId("sendTags")
record.setSchedule("ondemand")
record.setFailData("overwrite")
settingsRecord = settings.getTaskSettingsRecord()
meta = settingsRecord.getMeta()
settingsRecord.setString(meta.getField("targetGateways"), "Ignition-VM")
settingsRecord.setString(meta.getField("targetTagProvider"), "edge")
settingsRecord.setString(meta.getField("tagPaths"), "[default]test,")
settingsRecord.setBoolean(meta.getField("controllerIsTarget"), False)
settingsRecord.setString(meta.getField("collisionPolicy"), "overwrite")
settings.save()
And the error i got is:
Error running action 'component.onActionPerformed' on Pages/machine/settings/KPIs/addKPIForm@P-KEOuB09/root/submitRow/submit: Traceback (most recent call last): File "<function:runAction>", line 51, in runAction at simpleorm.sessionjdbc.SSessionJdbcHelper.flushExecuteUpdate(SSessionJdbcHelper.java:422) at simpleorm.sessionjdbc.SSessionJdbcHelper.flush(SSessionJdbcHelper.java:389) at simpleorm.sessionjdbc.SSessionJdbc.flush(SSessionJdbc.java:459) at simpleorm.sessionjdbc.SSessionJdbc.flush(SSessionJdbc.java:443) at simpleorm.sessionjdbc.SSessionJdbc.commitAndDetachDataSet(SSessionJdbc.java:382) at com.inductiveautomation.ignition.gateway.localdb.PersistenceInterfaceImpl.save(PersistenceInterfaceImpl.java:107) at com.inductiveautomation.ignition.gateway.tasks.TaskSettings.save(TaskSettings.java:69) at jdk.internal.reflect.GeneratedMethodAccessor391.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.base/java.lang.reflect.Method.invoke(Unknown Source) simpleorm.utils.SException$Jdbc: simpleorm.utils.SException$Jdbc: Executing INSERT INTO gatewaytaskrecord (gatewaytaskrecord_ID, name, ownerid, taskid, mode, schedule, faildata) VALUES (?, ?, ?, ?, ?, ?, ?) for [GatewayTaskRecord 34 NewRecord Dirty0]
Can anyone help me ?