Since Servoy version 7, we noticed that SQL statements containing the DISTINCT modifier no longer work. For example, the two methods below produce identical results (one has the DISTINCT modifier, the other does not have the modifier). The code with the DISTINCT modifier should only return one dataset item containing 'LONDON'; instead, it returns 4 items all of which are 'LONDON'.
- Code: Select all
function onShow(firstShow, event)
{
var SQL = "SELECT city FROM employees WHERE city = 'LONDON'"
var ds = databaseManager.getDataSetByQuery( 'example_data', SQL, null, 10 )
var length = ds.getMaxRowIndex()
if ( length < 1 ) application.closeSolution()
}
- Code: Select all
function onShow(firstShow, event)
{
var SQL = "SELECT DISTINCT city FROM employees WHERE city = 'LONDON'"
var ds = databaseManager.getDataSetByQuery( 'example_data', SQL, null, 10 )
var length = ds.getMaxRowIndex()
if ( length < 1 ) application.closeSolution()
}
Would someone care to verify this? The above code uses the 'example_data' database that comes with Servoy, so you should be able to cut and paste it into a sample solution.
Thanks!