DMXzone Server Connect Support Product Page

Answered

Sorting data by multiple columns

8 years ago Brad Lawryk posted:
I have a table I would like the user to have a choice of which column to sort by, I can not seem to find a way for it to work. Is it possible?

2016.wlstudiotheatre.com/productions.php

Replies

Replied 8 years ago
8 years ago Greta Garberini replied:
Replied 8 years ago
8 years ago Teodor Kuduschiev replied:
Hi Brad,
You can do this, for every column as described here: www.dmxzone.com/go/32351/sorting-database-query-results
Replied 8 years ago
8 years ago Brad Lawryk replied:
Greta: I think that is an old video and no longer applies?

Teodor: I had tried that. Perhaps you need to give a different variable name for each column? But how do you set a default sort order if the sort orders are dependant on a variable?
Replied 8 years ago
8 years ago Teodor Kuduschiev replied:
Hi Brad, you can set a default order, without the condition, then assign two more for both ASC/DESC. Yes, this should be done for each of the columns.
Replied 8 years ago
8 years ago Brad Lawryk replied:

i tried it but now the record set doesn't even show up.
Replied 8 years ago
8 years ago Teodor Kuduschiev replied:
Hi Brad, i see an Error 500 on your page. Please check this video: www.dmxzone.com/go/32354/debugging-problems-in-dmxzone-server-connect/
Replied 8 years ago
8 years ago Brad Lawryk replied:
Ok, I have the columns sorting nicely but how do I set a default sort order. I would like it to sort by the first column in descending order by default.
Replied 8 years ago
8 years ago Teodor Kuduschiev replied:
Did you try adding the desired sort order, without a condition? This should do the job.
Replied 8 years ago
8 years ago Brad Lawryk replied:
Yes, you would think that would work. But when you add one without a condition then none of the sorting works at all.
Replied 8 years ago
8 years ago Teodor Kuduschiev replied:
I will check this and will get back to you.
Replied 8 years ago
8 years ago Brad Lawryk replied:
Hi Teodor,

I just discovered that the sort without a condition has to be added last and at the bottom of the sort order list. Adding it first or in between causes it to stop working for any sort orders after it. Adding the sort without a condition last and to the bottom of the order solved the problem.
Replied 8 years ago
8 years ago Teodor Kuduschiev replied:
Happy to hear it is working now! I will check why it does not work, when it is added first ...

Reply to this topic