public void printWithOrder(ArrayList<Row> rows, ArrayList<Field> fields,
			boolean headerLine) {
		System.out.println("==============================================");
		if (rows.size() == 0) {
			System.out.println("No Result");
		}

		Collections.sort(fields);

		int lineSize = 0;
		Iterator<Field> itField = fields.iterator();
		while (itField.hasNext()) {
			Field f = itField.next();

			System.out.print(f.name);
			if (f.aggField != null) {
				System.out.print("[" + f.aggField + "]");
				lineSize += f.aggField.length() + 2;
			}
			lineSize += f.name.length();

			if (itField.hasNext()) {
				System.out.print(",");
				lineSize++;
			} else {
				System.out.println();
			}

		}
		if (headerLine) {
			for (int k = 0; k < lineSize; k++) {
				System.out.print("=");
			}
			System.out.println();
		}

		Iterator<Row> it = rows.iterator();

		int c = 0;
		while (it.hasNext()) {
			Row r = it.next();

			for (int i = 0; i < fields.size(); i++) {
				Field fKey = new Field();
				fKey.name = fields.get(i).name;
				String v = r.fields.get(fKey);
				System.out.print(v);
				if (i + 1 < fields.size()) {
					System.out.print(",");
				} else {
					System.out.println();
				}

			}

		}

		System.out.println("==============================================");
	}