Hi everybody.
I have the next code to allow the ignition system working in background while query with the other system is working in other way.
well, it not working i don´t know why , any idea?
The ignition is locked while query is being processed.
Thank you very much.
Eduardo.
p1=event.source.parent.zona
p2=event.source.parent.f_ini
p3=event.source.parent.f_fin
lotes=project.lotes.lotes(p1,p2,p3)
event.source.parent.getComponent('Power Table').data= system.dataset.toDataSet(lotes)
def async():
TABLA='APROL_DB'
texto='where'
for row in lotes:
zona=row["ZONA"]
f_ini=row["FECHA INICIO"]
f_ini=system.db.dateFormat(f_ini, "yyyy-MM-dd HH:mm:ss")
f_fin=row["FECHA FIN"]
f_fin=system.db.dateFormat(f_fin, "yyyy-MM-dd HH:mm:ss")
if texto=='where':
texto=texto+'(ts>'+"'"+f_ini+"'"+' AND ts<'+"'"+f_fin+"'"+' AND alias like '+"'"+zona+"'"+')'
else:
texto=texto+' OR (ts>'+"'"+f_ini+"'"+' AND ts<'+"'"+f_fin+"'"+' AND alias like '+"'"+zona+"'"+')'
#texto=texto+fecha
#system.gui.messageBox(texto)
texto_estatico='SELECT ts "FECHA/HORA",priority "PRIORIDAD",`group` "AGRUPACION",pv "VARIABLE",flags "MARCA",alias "ZONA",begin_ts "FECHA/HORA INIC.",end_ts "FECHA/HORA FIN",round(duration/1000,0) "DURACION",ack_ts "FECHA/HORA REC.",ack_text "TEXTO REC.",username "USUARIO",text "DESCRIPCION" FROM Alarm'
texto_fin=texto_estatico+" "+texto
#system.gui.messageBox(texto_fin)
def later():
system.gui.messageBox("estoy en later")
if lotes.getRowCount()!=0:
resultado_q=system.db.runQuery(texto_fin,TABLA)
event.source.parent.getComponent('Power Table APROL').data=resultado_q
else:
system.gui.messageBox("NO EXISTE NINGUN LOTE REGISTRADO CON ESAS RESTRICCIONES")
system.util.invokeLater(later)
#event.source.parent.getComponent('Animated Gif').visible=0
system.util.invokeAsynchronous(async)