# # ITSV GmbH # CCDB - Command and Control Database # # FILE: dquerymfile_consoleEvent.txt # DESCRIPTION: DQUERY definition for DQUERY consoleEvent # this query processes a console event from a DataControle view # @querytitle Datenkonsolen-Ereignis verarbeiten @querydescription verarbeitet ein Ereignis von einer Datenkonsole (view dataconsole) @group API @attributenames event,consolename:string:{{consolenameopts}},p1:string:{{p1options}} @consolenameopts {"is_optional":"true"} @p1options { is_optional: true } @querytype function @function seqtrans.seqtrans @title Konsol-Kommando ~query.tsteps # # <>: determine request type from request attribute event # pre_qexpression proc: { this.evp_labelname = 'event_'+this.query.event; if (!this.labels[this.evp_labelname]) { this.errcoll.collect(null,"Cannot process Event \""+this.query.event+"\", label \""+this.evp_labelname+"\" does not exist",this.query); break proc; } } goto @@evp_labelname@@ # # <>: start - get console initial data from database # event_startConsole: pre_qexpression if (this.debug) logger.debug(this.phead("startConsole")+".query: "+aux.objTxt(this.query)); this.coname = this.query.consolename; this.p1 = this.query.p1; this.cosel = 'consinststart_'+this.coname; sql select data from CCTEXTFRAG where type='consinst' and ident=::cosel:: and child_index=0 and frag_index=0 named_params cosel result_varname tres post_qexpression proc: { if (this.tres.getRowCount()!=1) { this.errcoll.collect(null,"DB query result for console event \""+this.query.event+"\" for console \""+this.coname+"\" got wrong count of rows",this.tres); break proc; } let cod = aux.txtObjDecode(this.tres.getCellValue(0,0)); if (cod.error) { this.errcoll.collect(cod.error,"Error parsing text fragment \""+this.cosel+"\" value \""+this.tres.getCellValue(0,0)+"\"",this.tres); break proc; } else { if (this.debug) logger.debug(this.phead("startConsole")+".cod: "+aux.objTxt(cod)); aux.populateAllStrings(cod,{ context: this, scontext: this.query, populate_options: { dbg: true, delimname: 'double_hashes' } }); this.codata = cod; if (this.debug) logger.debug(this.phead("startConsole")+".codata: "+aux.objTxt(this.codata)); } } # # <>: start - have console data, return to client # qexpression this.codata.command = 'start'; this.result = new aux.Result("transparent"); this.result.res = this.codata; # # 3: saveAs - save to textfragment # #