Hi, we noticed a bug for quite some time in Servoy 5 for which we have an easy workaround. Now I thought is a good time to share it with you :
Scenario :
_fs = databaseManager.getFoundset(‘user_data’, ‘some_table’)
_fs.sort(‘sortfield1 asc, sortfield2 asc’)
_fs.loadAllRecords()
var _max = databaseManager.getFoundSetCounf(_fs)
for (var i=1; i<=_max; i++) {
_fs.setSelectedIndex(i)
// do something nice like simulate an aggregrate…
}
How can this go wrong ?
Something goes wrong when _fs index 200 and _fs index 201 have the same values for sortfield1 and sortfield2. Yes, the famous Servoy foundset 200…
In that case the _fs index 201 data is identical to _fs index 199 data including pk value !! Record 199 seems duplicated in the foundset.
Workaround : add the pk field to the sort and the foundset is ok…
You can imagine this bug can cost some debug hours to discover…
Regards,