=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/i18n/I18nFormat.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/i18n/I18nFormat.java 2011-03-18 09:47:06 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/i18n/I18nFormat.java 2011-03-20 13:35:54 +0000 @@ -46,6 +46,7 @@ { private static final DecimalFormat FORMAT_VALUE = new DecimalFormat( "#.#;#.#" ); // Fixed for now private static final String EMPTY = ""; + private static final String NAN = "NaN"; private ResourceBundle resourceBundle; @@ -185,7 +186,19 @@ public String formatValue( Object value ) { - return value != null ? FORMAT_VALUE.format( value ) : EMPTY; + if ( value == null ) + { + return EMPTY; + } + + try + { + return FORMAT_VALUE.format( value ); + } + catch ( IllegalArgumentException ex ) + { + return NAN; + } } // ------------------------------------------------------------------------- === modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateSectionDataSetReportAction.java' --- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateSectionDataSetReportAction.java 2011-03-16 21:25:24 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/dataset/action/GenerateSectionDataSetReportAction.java 2011-03-20 13:35:54 +0000 @@ -57,7 +57,6 @@ import org.hisp.dhis.system.filter.AggregatableDataElementFilter; import org.hisp.dhis.system.grid.ListGrid; import org.hisp.dhis.system.util.FilterUtils; -import org.hisp.dhis.system.util.MathUtils; import com.opensymphony.xwork2.Action; @@ -250,20 +249,18 @@ for ( DataElementCategoryOptionCombo optionCombo : categoryCombo.getOptionCombos() ) // Values { - String value = null; + Double value = null; if ( selectedUnitOnly ) { DataValue dataValue = dataValueService.getDataValue( selectedOrgunit, dataElement, selectedPeriod, optionCombo ); - value = (dataValue != null) ? dataValue.getValue() : null; + value = dataValue != null && dataValue.getValue() != null ? Double.parseDouble( dataValue.getValue() ) : null; } else { - Double aggregatedValue = realTime ? + value = realTime ? aggregationService.getAggregatedDataValue( dataElement, optionCombo, selectedPeriod.getStartDate(), selectedPeriod.getEndDate(), selectedOrgunit ) : aggregatedDataValueService.getAggregatedValue( dataElement, optionCombo, selectedPeriod, selectedOrgunit ); - - value = aggregatedValue != null ? String.valueOf( MathUtils.getRounded( aggregatedValue, 0 ) ) : null; } grid.addValue( value ); @@ -277,7 +274,7 @@ aggregationService.getAggregatedDataValue( dataElement, selectedPeriod.getStartDate(), selectedPeriod.getEndDate(), selectedOrgunit, categoryOption ) : aggregatedDataValueService.getAggregatedValue( dataElement, categoryOption, selectedPeriod, selectedOrgunit ); - grid.addValue( value != null ? String.valueOf( MathUtils.getRounded( value, 0 ) ) : null ); + grid.addValue( value ); } } @@ -287,7 +284,7 @@ aggregationService.getAggregatedDataValue( dataElement, null, selectedPeriod.getStartDate(), selectedPeriod.getEndDate(), selectedOrgunit ) : aggregatedDataValueService.getAggregatedValue( dataElement, selectedPeriod, selectedOrgunit ); - grid.addValue( value != null ? String.valueOf( MathUtils.getRounded( value, 0 ) ) : null ); + grid.addValue( value ); } } === modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/dataSetReportForm.vm' --- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/dataSetReportForm.vm 2011-03-19 22:30:32 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/dataSetReportForm.vm 2011-03-20 13:35:54 +0000 @@ -64,7 +64,7 @@ -
+