I’m trying to create a DB Data Source using GET parameters to modify the functionality of the query on the fly. Essentially I’m trying to implement a server-side Datatables processing thing close to the level of functionality in that PHP script.
I’ve got pagination and sorting, but I’m having difficulty with ordering. I’ve tried the following:
ORDER BY %%iSortCol_0%% %%sSortDir_0%%
Which obviously doesn't work, because after escaping it equates to something like:
ORDER BY '1' 'asc'
Sadly I don't have the first clue where to go from here. I've tried to_number(%%iSortCol_0%%), which converts the 'string' to a number which doesn't throw any errors but still fails to sort.
I just can't think of any way to programmatically determine the sort order and direction based on these strings in SQL. We're eventually going to end up with thousands and thousands of rows, so I don't particularly want to have to pull the entire lot down into Matrix to sort it. So with that in mind, I'm wodnering if anyone else might have any ideas as to what else I can try?
Cheers,
Ash.