dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #03598
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1200: Fixed bug #494408
------------------------------------------------------------
revno: 1200
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Thu 2009-12-10 10:13:44 +0100
message:
Fixed bug #494408
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/statement/GetReportTableDataStatement.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription.
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java 2009-12-10 07:54:05 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java 2009-12-10 09:13:44 +0000
@@ -748,7 +748,17 @@
return !isDoIndicators() && !isDoPeriods() && !isDoUnits() &&
isDimensional( DimensionType.CATEGORY ) && mode.equals( MODE_DATAELEMENTS );
}
-
+
+ /**
+ * Returns a List containing index and select columns.
+ */
+ public List<String> getIndexAndSelectColumns()
+ {
+ List<String> columns = new ArrayList<String>( indexColumns );
+ columns.addAll( selectColumns );
+ return columns;
+ }
+
// -------------------------------------------------------------------------
// Supportive methods
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/statement/GetReportTableDataStatement.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/statement/GetReportTableDataStatement.java 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/statement/GetReportTableDataStatement.java 2009-12-10 09:13:44 +0000
@@ -56,7 +56,7 @@
{
StringBuffer buffer = new StringBuffer();
- buffer.append( "SELECT value, " );
+ buffer.append( "SELECT SUM(value), " );
Iterator<String> selectColumns = reportTable.getSelectColumns().iterator();
@@ -80,6 +80,15 @@
buffer.append( "AND " + indexColumn + "='" + QUERY_PARAM_ID + indexColumn + "' " );
}
+ buffer.append( "GROUP BY " );
+
+ selectColumns = reportTable.getIndexAndSelectColumns().iterator();
+
+ while( selectColumns.hasNext() )
+ {
+ buffer.append( selectColumns.next() + ( selectColumns.hasNext() ? SEPARATOR : SPACE ) );
+ }
+
statement = buffer.toString();
}