Named Query Sorted different when exported

The sort order as part of the query is not something that can be changed by parameterization (outside the 'query string' parameter type, which has drawbacks), and databases are really good at sorting operations.

If you are only talking about a few hundreds-thousands of rows, it's absolutely possible to sort the data locally on your machine - there's a sortDataset expression function or the system.dataset.sort scripting function. Whether it makes sense to do that vs creating a near duplicate name query is up to you.

1 Like