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
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.
Thank you for your reply Mike Schmitt ,i didn't get what you are trying to say
i'm saying you can handle sorting in queries by adding a new / separate column, which would hold sequential numbers (i.e. 1 - 3 in your case), ordered per how you want the results to come back. such a column would usually be named "ordinal" or maybe "sort order" (the name doesn't matter much as long as its intention is clear). this also enables you to change the default queried order in the future without having to "fix" how the elements are queried onto interfaces.