=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcAnalyticsTableManager.java' --- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcAnalyticsTableManager.java 2013-03-18 16:39:07 +0000 +++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcAnalyticsTableManager.java 2013-04-19 16:40:53 +0000 @@ -44,6 +44,7 @@ import org.hisp.dhis.period.Period; import org.hisp.dhis.period.PeriodType; import org.hisp.dhis.system.util.DateUtils; +import org.hisp.dhis.system.util.MathUtils; import org.springframework.scheduling.annotation.Async; /** @@ -120,7 +121,7 @@ Date startDate = period.getStartDate(); Date endDate = period.getEndDate(); - String intClause = "dv.value != '' and dv.value != 'true' and dv.value != 'false' and dv.value not like '%-%'"; + String intClause = "dv.value " + statementBuilder.getRegexpMatch() + " '" + MathUtils.NUMERIC_REGEXP + "'"; populateTable( table, startDate, endDate, "cast(dv.value as " + dbl + ")", "int", intClause ); === modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/StatementBuilder.java' --- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/StatementBuilder.java 2012-12-04 08:35:56 +0000 +++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/StatementBuilder.java 2013-04-19 16:40:53 +0000 @@ -66,6 +66,12 @@ String getDoubleColumnType(); /** + * Returns the value used to match a column to a regular expression. + * @return the value used to match a column to a regular expression. + */ + String getRegexpMatch(); + + /** * Creates a SELECT statement returning the identifier of the given Period. * * @param period the Period to use in the statement. === modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/H2StatementBuilder.java' --- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/H2StatementBuilder.java 2013-04-04 14:30:43 +0000 +++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/H2StatementBuilder.java 2013-04-19 16:40:53 +0000 @@ -46,6 +46,12 @@ { return null; } + + @Override + public String getRegexpMatch() + { + return "regexp"; + } @Override public String getDeleteZeroDataValues() === modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/MySQLStatementBuilder.java' --- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/MySQLStatementBuilder.java 2013-04-04 14:30:43 +0000 +++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/MySQLStatementBuilder.java 2013-04-19 16:40:53 +0000 @@ -48,6 +48,12 @@ } @Override + public String getRegexpMatch() + { + return "regexp"; + } + + @Override public String getDeleteZeroDataValues() { return === modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/PostgreSQLStatementBuilder.java' --- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/PostgreSQLStatementBuilder.java 2013-04-04 14:30:43 +0000 +++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/statementbuilder/PostgreSQLStatementBuilder.java 2013-04-19 16:40:53 +0000 @@ -48,6 +48,12 @@ } @Override + public String getRegexpMatch() + { + return "~"; + } + + @Override public String getDeleteZeroDataValues() { return === modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/MathUtils.java' --- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/MathUtils.java 2013-04-19 15:02:38 +0000 +++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/MathUtils.java 2013-04-19 16:40:53 +0000 @@ -46,7 +46,9 @@ private static final double TOLERANCE = 0.01; - private static final Pattern NUMERIC_PATTERN = Pattern.compile( "^(0|-?[1-9]\\d*)(\\.\\d+)?$" ); + public static final String NUMERIC_REGEXP = "^(0|-?[1-9]\\d*)(\\.\\d+)?$"; + + private static final Pattern NUMERIC_PATTERN = Pattern.compile( NUMERIC_REGEXP ); private static final Pattern INT_PATTERN = Pattern.compile( "^(0|-?[1-9]\\d*)$" ); private static final Pattern POSITIVE_INT_PATTERN = Pattern.compile( "^[1-9]\\d*$" ); private static final Pattern NEGATIVE_INT_PATTERN = Pattern.compile( "^-[1-9]\\d*$" );