public String createOutput() {

        // ************* prepare the temporary tables ***************
               
        // ************ PERFORMANCE WATCH ***************
        long perfWatch;
        // **********************************************

        // get a name for the temporary table
        tmpTableAll = dq.getUniqueName("statusTmp");
        
        if (remDoubles) {  
            // retrieve all data into one table and copy it without identical entries into second table
            tmpTableReduced = dq.getUniqueName("statusTmpNoDoubles");
            if (dq.fillTable(tmpTableAll, null, null, false, false, 1)==false) {
                output += dq.getOutput();
                return "Error creating and filling temporary table! <p>"+output;
            }
            // ************ PERFORMANCE WATCH ***************
            perfWatch = System.currentTimeMillis();
            // **********************************************
            dq.removeIdenticalData(tmpTableAll, tmpTableReduced, remTimeDiv, remExporterID, true);
        } else {
            // no removal of identical entries, just copy the name of the temp. table
            // and only retrieve necessary data
            tmpTableReduced = tmpTableAll;
            String createTmp = "CREATE TEMPORARY TABLE "+tmpTableAll+" (srcIP INTEGER(10) UNSIGNED, dstIP INTEGER(10) UNSIGNED," +
				"srcPort SMALLINT(5) UNSIGNED, dstPort SMALLINT(5) UNSIGNED, " +
				"proto TINYINT UNSIGNED, " +
				"bytes BIGINT(20) UNSIGNED, " +
				"firstSwitched INTEGER(10) UNSIGNED, " +
                                "databaseID SMALLINT(5) UNSIGNED)";
            String fillTmp = "SELECT SQL_BIG_RESULT srcIP, dstIP, srcPort, dstPort, proto, bytes," +
                                 " firstSwitched, databaseID FROM #srctable# WHERE " +
                                 "#params#";
            if (dq.fillTable(tmpTableAll, createTmp, fillTmp, false, false, 1)==false) {
                output += dq.getOutput();
                return "Error creating and filling temporary table! <p>"+output;
            }
            // ************ PERFORMANCE WATCH ***************
            perfWatch = System.currentTimeMillis();
            // **********************************************
        }

        // ************* build the eight standard charts *******************
        for (int i=1; i<=8; i++) request.getSession().getServletContext().removeAttribute("status"+i);
        try {
            generateTrafficCharts("status1","status2");
            for (short whatPie=1; whatPie<=3; whatPie++)
                generatePortAndProtoCharts(whatPie,"status"+(whatPie+2));
            for (short whatChart=1; whatChart<=3; whatChart++)
                generateTopNetsCharts(whatChart,"status"+(whatChart+5));
        } catch (Exception e) {
            output += "<p>Error creating charts.<p>" + e.getMessage() + "<p>";
            dq.dropTable(tmpTableAll);
            dq.dropTable(tmpTableReduced);
            return output + "<p>" + dq.getOutput();
        }

        // drop the temporary tables
        dq.dropTable(tmpTableAll);
        dq.dropTable(tmpTableReduced);
		
        // ************ finished, return the constructed output **************

        output += dq.getOutput();
        
        // ************ PERFORMANCE WATCH ***************
        output += "<p>Time to rearrange data and query temp. tables: " + (System.currentTimeMillis()-perfWatch) + " ms<p>";
        // **********************************************
        
        // return results of query
        // (created charts have been stored as objects in the session context and are painted
        // by invoking the ChartsDeliverer-servlet)
        return 	"<b>Monitored Traffic from " + dq.createTimeOutput(startTime) + " to " + dq.createTimeOutput(endTime) + " </b><p>" +
                "<hr><table><tr><td><IMG src=\"/nasty/ChartsDeliverer?chartname=status1\"></td>" +
                "<td><IMG src=\"/nasty/ChartsDeliverer?chartname=status2\"></td></tr></table><p>" + 
                "<hr><table><tr><td><IMG src=\"/nasty/ChartsDeliverer?chartname=status3\"></td>" + 
                "<td><IMG src=\"/nasty/ChartsDeliverer?chartname=status4\"></td>" + 
                "<td><IMG src=\"/nasty/ChartsDeliverer?chartname=status5\"></td></tr></table><p>" + 
                "<hr><table><tr><td><IMG src=\"/nasty/ChartsDeliverer?chartname=status6\"></td>" + 
                "<td><IMG src=\"/nasty/ChartsDeliverer?chartname=status7\"></td></tr></table><p>" + 
                "<hr><table><tr><td><IMG src=\"/nasty/ChartsDeliverer?chartname=status8\"></td></tr></table><p>" + 
                "<hr><p>" + output;
    }