# # ITSV GmbH # CCDB - Command and Control Database # # FILE: dquerymfile_SVCL52BUILDZA2K.txt # DESCRIPTION: DQUERY definition for DQUERY SVCL52BUILDZA2K # This query builds a ZA2K dataset for SVCLEAR-52 # by selecting all ZUORDnungen created before and at 24.02.2020 # to be annotated afresh by SVZ_AUTO # # Dateiname: ZA2KF_.csv # Format: CSV, Field Separator „;“, optionales Quoting von Felder n mit Anführungszeichen („), Escaping von Anführungszeichen durch Verdoppelung # Die erste Zeile beinhaltet die Attributnamen wie in der folgenden Tabelle # Größe: wahrscheinlich bis zu 600.000 Datensätze pro Datei # # name - Datentyp - Erklärung # UCLLI - varchar(32) - „ZA2KR_nnnnnnnnnnnnnn“, eindeutige ID genau dieses Datensatzes (zur Verfolgung) # VERWENDUNG - varchar(32 - Verwendungszweck dieses Datensatzes, im Bestand ZA2K ist das „ZA2KR_“, wobei die Nummer wie im Dateinamen ist # ZUOID - varchar(32) - Zuordnungs-ID, eindeutig in ELDA # TRAEGER - varchar(2) - Träger-ID des Beitragskontos (11..19, 05) # BKNR - varchar(32) - Beitragskontonummer # SERIENNUMMER - varchar(32) - ELDA-Seriennummer zu der die Zuordnung besteht # AKTIVVON - varchar(32) - Beginndatum der Gültigkeit im Format YYYYMMDDhhmmssttt # AKTIVBIS - varchar(32) - Endedatum der Gültigkeit im Format YYYYMMDDhhmmssttt, oder leer (wenn kein Endedatum bekannt – noch aktiv) # ENDEGRUND - varchar(255) - Grund der Beendigung (Details bekomme ich erst von Oliver) # @querytitle SVCLEAR-52: ZA2K Bestand erstellen @querydescription Diese Abfrage erstellt einen Bestand ZA2K mit der Kennnummer wie vereinbart lt. https://doku.seu.sozvers.at/confluence_secure/display/SVCLEAR/SVCLEAR-52+-+Vorgehensweise+Korrektur Dazu werden alle Zuordnungen aus SVCLZUORD ausgewählt, die vor oder am 24.02.2020 angelegt wurden. (Diese ZUOs wurden von der SVZ_AUTO am 24.02.2020 potentiell falsch gekennzeichnet, daher sind sie neu zu kennzeichnen) @group SVCLCASETOOLS @attributenames setnum:string:{{setnumoptions}} @setnumoptions { labeltext: "Bestandskennung", typedesc: "Eindeutige Kennung für den zu erstellenden Bestand" } @querytype function @function seqtrans.seqtrans @sql_select SELECT ID,SERIENNUMMER,TRAEGER,BKNR,INHPARID,INHROLLE,AKTIVVONDATNUM,AKTIVBISDATNUM from SVCLZUORD where AKTIVVONDATNUM<20200225000000000 @FLIST UCLLI,VERWENDUNG,ZUOID,TRAEGER,BKNR,SERIENNUMMER,AKTIVVON,AKTIVBIS,ENDEGRUND ~query.tsteps # # <>: skip init if already done # if (this.init_done) goto record_proper # # <>: init: create output table: if already there, this will fail and cancel the whole query # pre_qexpression this.query.TFLIST = "::" + this.query.FLIST.split(",").join("::,::") + "::"; this.copyqvars("setnum,FLIST,TFLIST"); this.recstoprocess = this.inputresult.getRowCount(); this.recsprocessed = 0; this.tablename = "SVCL_ZA2K_"+this.setnum; sql create table @@tablename@@ ( UCLLI varchar(32), VERWENDUNG varchar(32), ZUOID varchar(32), TRAEGER varchar(2), BKNR varchar(32), SERIENNUMMER varchar(32), AKTIVVON varchar(32), AKTIVBIS varchar(32), ENDEGRUND varchar(255)) result_varname dbres post_qexpression this.ppush([this.phead("TABLECREATED"), "TABLE_NAME="+this.tablename, "RECS2PROCESS="+this.inputresult.getRowCount(), this.dbres]); this.init_done = true; # # <>: process current record, add UCLLI attribute and insert into table # record_proper: pre_qexpression proc: { this.cdata.UCLLI = "ZA2KR_"+aux.syncUniqueNowID(); this.cdata.VERWENDUNG = "ZA2KR_"+this.setnum; this.cdata.ZUOID = this.cdata.ID; if (!this.cdata.ID) { this.errcoll.collect(null,"ZUOID of record "+this.recnum+" is missing",this.cdata); break proc; } this.cdata.AKTIVVON = this.cdata.AKTIVVONDATNUM || ""; this.cdata.AKTIVBIS = this.cdata.AKTIVBISDATNUM || ""; this.cdata.ENDEGRUND = this.cdata.ENDEGRUND || ""; } sql insert into SVCL_ZA2K_@@setnum@@(@@FLIST@@) values(@@TFLIST@@) named_params @@FLIST@@ post_qexpression this.recsprocessed++; if (this.recsprocessed%100==0) logger.debug(this.phead("PROGRESS.RECSPROCESSED="+this.recsprocessed)); # # <>: lst record? # if (!this.is_last_record) goto record_end # # <>: last record, protocol summary # qexpression this.ppush([ this.phead("COMPLETE"), { recstoprocess: this.recstoprocess, recsprocessed: this.recsprocessed }, "Tabelle "+this.tablename+" angelegt", "" ]); # # <>: end of record # record_end: end