Hi everyone,
There is a read-only grid that uses a record-type data source. The table structure is as follows: Request Id (Primary Key) Name (varchar) In the grid filters, I’m applying a filter on the Request Id using the IN operator, and passing the values {9, 5, 3}. However, the grid displays the results in sorted order as {3, 5, 9}. I want the grid to display the records in the same sequence as the values I pass in the filter — i.e., {9, 5, 3} — without sorting them. How can I achieve this?
Thanks in advance !
Discussion posts and replies are publicly visible
A database or record query will not return the data in such a specific order.
You need to query the data separately into a local variable. Then you can iterate on the PKs and fetch the items from the result set in that order. Then you can feed that final list into the grid.
Thank you for your reply Stefan Helzle if we use data source as one local variable then export excel will not work
True. But if you need this, I do not see any option to implement your requirement.
You would need to add a new column to your DB table (and/or to your record type) that determines the sort order, apart from the primary key ID. Usually I've seen this sort of column named "ordinal" or similar, and just contains sequential integer values (i.e. 1, 2, 3), and the query can sort by that by default instead of sorting on a different column value.