bug foundset sort

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,

Lambert,

Firstly, I want to thank you for posting your findings. I have seen this behavior before but could not pin-point the source (nor did I have the time to investigate). And, yes, I believe you put in an inordinate amount of time to discover this bug (again, thank you).

You definitely should post your discovery on the support site: http://www.servoy.com/s

owww wow, that’s tricky indeed, +1 to create a ticket!!

Ok, https://support.servoy.com/browse/SVY-1975

Regardjes,