← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6640: local vn - Fixed expression.

 

------------------------------------------------------------
revno: 6640
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-04-19 12:15:58 +0700
message:
  local vn - Fixed expression.
modified:
  local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportAttributeAction.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 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportAttributeAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportAttributeAction.java	2012-04-19 03:58:49 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/action/GenerateReportAttributeAction.java	2012-04-19 05:15:58 +0000
@@ -32,8 +32,11 @@
 import java.util.Collections;
 import java.util.List;
 
+import static org.hisp.dhis.expression.Expression.SEPARATOR;
+
 import org.apache.poi.ss.usermodel.Sheet;
 import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.dataelement.DataElementFormNameComparator;
 import org.hisp.dhis.dataelement.LocalDataElementService;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -83,6 +86,8 @@
     private void generateOutPutFile( ExportReportAttribute exportReport, Collection<ExportItem> exportReportItems,
         OrganisationUnit organisationUnit, Sheet sheet )
     {
+        DataElementCategoryOptionCombo defaultOptionCombo = categoryService.getDefaultDataElementCategoryOptionCombo();
+
         for ( ExportItem exportItem : exportReportItems )
         {
             int rowBegin = exportItem.getRow();
@@ -115,18 +120,18 @@
                     }
                     else
                     {
+                        int innerColumn = exportItem.getColumn();
+
+                        ExportItem newExportItem = new ExportItem();
+
                         dataElements = new ArrayList<DataElement>( localDataElementService.getDataElementsByAttribute(
                             avgOrder.getAttribute(), avalue ) );
 
                         Collections.sort( dataElements, new DataElementFormNameComparator() );
 
-                        ExportItem newExportItem = new ExportItem();
-
-                        int innerColumn = exportItem.getColumn();
-
                         for ( DataElement de : dataElements )
                         {
-                            newExportItem.setExpression( String.valueOf( de.getId() ) );
+                            newExportItem.setExpression( de.getId() + SEPARATOR + defaultOptionCombo.getId() );
 
                             double value = this.getDataValue( newExportItem, organisationUnit );