anchor.diff:      connmaker cn = null;
       sqlcontroller scontroller= null;
   
  -    String patient = (request.getParameter("PATIENT").trim());
  -    String test_type = (request.getParameter("TESTTYPE").trim());
  -    String time_period = (request.getParameter("TIMEPERIOD").trim());
  +    String patient = (request.getParameter("PATIENT"));
  +    String test_type = (request.getParameter("TESTTYPE"));
  +    String time_period = (request.getParameter("TIMEPERIOD"));
   
       //Create sql statement based on user's choice
  -    String sqlString = "SELECT ";
  +    String sqlString = "SELECT";
       String dataCube = "GROUP BY CUBE (";
       String description = "Displaying number of images for each ";
   
  -    if (patient.equals("True")) {
  -        String nameParam = "first_name, last_name, ";
  +    if ((patient != null) && (patient.equals("True"))) {
  +        String nameParam = " first_name, last_name,";
           sqlString += nameParam;
           dataCube += nameParam;
  -        description += "patient, ";
  +        description += " patient,";
       }
  -    if (test_type.equals("True")) {
  -        String testTypeParam = "test_type, ";
  +    if ((test_type != null) && (test_type.equals("True"))) {
  +        String testTypeParam = " test_type,";
           sqlString += testTypeParam;
           dataCube += testTypeParam;
  -        description += "test type, ";
  +        description += " test type,";
       }
  -    if (time_period.equals("Yearly")) {
  -        String yearParam = "TRUNC(test_date, 'YEAR'), ";
  +    if (!(time_period.equals("None")) && (time_period.equals("Yearly"))) {
  +        String yearParam = " TRUNC(test_date, 'YEAR') AS time,";
           sqlString += yearParam;
  -        dataCube += yearParam;
  -        description += "year, ";
  +        dataCube += " TRUNC(test_date, 'YEAR'),";
  +        description += " year,";
       }
  -    if (time_period.equals("Monthly")) {
  -             String monthParam = "TRUNC(test_date, 'MONTH'), ";
  +    if (!(time_period.equals("None")) && (time_period.equals("Monthly"))) {
  +             String monthParam = " TRUNC(test_date, 'MONTH') AS time,";
                sqlString += monthParam;
  -             dataCube += monthParam;
  -             description += "month, ";
  +             dataCube +=  " TRUNC(test_date, 'MONTH'),";
  +             description += " month,";
        }
  -    if (time_period.equals("Weekly")) {
  -             String weekParam = "TRUNC(test_date, 'WW'), ";
  +    if (!(time_period.equals("None")) && (time_period.equals("Weekly"))) {
  +             String weekParam = " TRUNC(test_date, 'WW') AS time,";
                sqlString += weekParam;
  -             dataCube += weekParam;
  -             description += "week, ";
  +             dataCube += " TRUNC(test_date, 'WW'),";
  +             description += " week,";
        }
   
  -    sqlString = sqlString.replaceAll(",$", "");
       dataCube = dataCube.replaceAll(",$", "");
  +    dataCube += ")";
       description = description.replaceAll(",$", ":");
       sqlString += " COUNT(image_id) FROM analysis_view ";
       sqlString += dataCube;
  
positive.code:        conn.close();
      }
  
  
      if (rset != null && rset.next()) {
          out.println(description);
          out.println(rset.getString("COUNT(image_id)"));
      } else {
          out.println("Error: Could not generate analysis");
      }
  
      conn.close();
  	out.println("<a href='./UserManageMenu.html'>Return to menu</a>");
  }
  
  else{ %>
  
negative.code:     ResultSet rset = null;
  
      try{
  	out.println(sqlString);
          stmt = conn.createStatement();
          rset = stmt.executeQuery(sqlString);
  
  