I want to modify the .Start_Date and End Date from a Date Range with a SQL Query result
The code:
import system
import sys
OF = event.source.parent.getComponent(‘Busca_OF’).intValue
buscaIni = “SELECT FECHAINICIO FROM HISTORICOS_OF WHERE ORDEN =’%i’” %(OF),“again”
buscaFin = “SELECT FECHAFIN FROM HISTORICOS_OF WHERE ORDEN =’%i’” %(OF),“again”
Inicio = system.db.run.PrepQuery(buscaIni)
Fin = system.db.run.PrepQuery(buscaFin)
if event.button == 1:
event.source.parent.getComponent(‘Date Range’).Start_Date = Inicio
event.source.parent.getComponent(‘Date Range’).End_Date = Fin
I get:
Traceback (most recent call last):
File “event:mouseClicked”, line 6, in
AttributeError: ‘com.inductiveautomation.ignition.common.script.Scr’ object has no attribute ‘run’
Any Idea?