controller.loadRecords(dataset) issue

Since updating to 3.5.10 we have an issue with displaying records in the right order, by loading a -sorted- dataset with controller.loadRecords(dataset) using a custom query.

For example:

var vSQL = 'SELECT n.nav_item_id FROM nav_item n \
				WHERE n.parent_id = ? \
				AND n.show_nav_chk = ? \
				ORDER BY n.sort_order asc'
var vDS = databaseManager.getDataSetByQuery(controller.getServerName(), vSQL, [0,1], -1)
controller.loadRecords(vDS)

When executing the query in a dbtool, the sort order is correct, but Servoy displayes the records in another (random?) order.
Any suggestions how to fix this issue?

how about

foundset.loadRecords(vSql)

?

(should be faster also - only one query needed).

Karel,

This is a side-effect of this fix:

[fix] case 214220: controller.loadrecords(dataSet) does not apply table filters when records are cached

When you have table filters installed we force a new query to filter out the pks that do not match the filter.
You can add a sort() call to correct the sorting.

If you want to reduce the number of queries you can also use find:

if (controller.find())
{
    parent_id = 0
    show_nav_chk = 1
    controller.sort('sort_order asc')
    controller.search()
}

Rob

rgansevles:
When you have table filters installed we force a new query to filter out the pks that do not match the filter.
You can add a sort() call to correct the sorting.

Hi Rob! Thank you, the sort() call fixes indeed the sorting.
Unfortunatly, we use sorted data and foundsets set by a custom query, many, many times in different (custom) solutions…
I would be very happy if Servoy could supply a fix for this!

Case 221297 is posted in Servoy support system for this issue.