#
#		ITSV GmbH
#	CCDB - Command and Control Database
#
#	FILE:			dquermfile_SVCLEARCuCCCallCount.txt
#	DESCRIPTION:	DQUERY definition for CCDB DQUERY "SVCLEARCuCCCallCount"
#
@querytitle				Daten-Abfrage von CuCC-Anrufanzahlen über Zeitraum
@querydescription		
@group					SVCLSLSTATSTAT
@attributenames			accpertype:cuccaccpertype,restype:cuccrestype
@sql
		SELECT datum as MONDAY,		
		   (CASE WHEN eventUnit='Zeit' THEN eventTime		
		    ELSE eventNumber END) as AMOUNT 		
		   FROM CCSERVSTAT		
		  where accPeriodType='{{accpertype}}' and eventType='Anrufzahlen' and eventCategory='{{restype}}'
@post_query
		var nl = that.result.rows.length;		
		var tv = 0; 		
		for (var i=0; i<nl; i++) { 		
		  tv = aux.secondsFromISOtimeString(that.result.rows[i][1]);		
		  if (tv>=0) {		
		    that.result.rows[i][1] = tv;		
		  }		
		  that.result.rows[i][0]=aux.dateformat(that.result.rows[i][0],'yyyy-mm-dd'); 		
		}		
		'post_processed '+nl+' rows'
