#
#	ITSV GmbH
#	CCDB - Command and Control Database
#
#	FILE:			dquermfile_seq2trans.txt
#	DESCRIPTION:	DQUERY definition for CCDB DQUERY "seq2trans"
#
@querytitle			Sequence-prozessor
@querydescription	Arbeitet eine Sequence mit Hilfe einer Transaction-Sequence ab, um die Implementierung der querytype SEQUENCE obsolet zu machen
@group				ADMIN
@hidden				true
@attributenames		sequence:string:{{sequenceoptions}}
@sequenceoptions	{"labeltext":"Sequenz","typedesc":"Durch Komma getrennte Liste von Abfrage-IDs, die hintereinander abgearbeitet werden sollen"}
@querytype			function
@function			seqtrans.seqtrans
@puth				1

~query.tsteps

#
#	<<TSTEPNUM:0>>:	initialization
#
qexpression
	proc: {
		this.seqlist = this.query.sequence;
		this.seqsteps = this.seqlist.split(",");
		this.css = 0;
	}

#
#	<<TSTEPNUM:1>>: check if we have any sequence steps left
#
nextss:
if 		(this.css>=this.seqsteps.length)
goto 	record_done

#
#	<<TSTEPNUM:2>>: perform next query in sequence
#
pre_qexpression
	this.cdn = this.seqsteps[this.css];
query.dataname		@@cdn@@
post_qexpression
	if (this.query["post_step_"+this.css]) {
		eval(this.query["post_step_"+this.css]);
	}
	ppush(this,{type: "result", result: aux.deepCopy(this.stepresult)});
	this.css++;

#
#	<<TSTEPNUM:3>>: rinse and repeat ...
#
goto	nextss

#
#	<<TSTEPNUM:4>>: record done
#
record_done:
end
