DMXzone Server Connect Support Product Page

Answered

Sorting data by multiple columns

Asked 02 Jun 2016 02:45:50
1
has this question
02 Jun 2016 02:45:50 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 02 Jun 2016 05:05:50
02 Jun 2016 05:05:50 Greta Garberini replied:
Replied 02 Jun 2016 06:05:10
02 Jun 2016 06:05:10 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 02 Jun 2016 18:33:36
02 Jun 2016 18:33:36 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 03 Jun 2016 10:01:14
03 Jun 2016 10:01:14 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 03 Jun 2016 14:53:27
03 Jun 2016 14:53:27 Brad Lawryk replied:

i tried it but now the record set doesn't even show up.
Replied 03 Jun 2016 15:16:00
03 Jun 2016 15:16:00 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 09 Jun 2016 01:54:25
09 Jun 2016 01:54:25 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 09 Jun 2016 10:53:23
09 Jun 2016 10:53:23 Teodor Kuduschiev replied:
Did you try adding the desired sort order, without a condition? This should do the job.
Replied 09 Jun 2016 14:15:54
09 Jun 2016 14:15:54 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 09 Jun 2016 14:36:41
09 Jun 2016 14:36:41 Teodor Kuduschiev replied:
I will check this and will get back to you.
Replied 09 Jun 2016 14:59:59
09 Jun 2016 14:59:59 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 09 Jun 2016 15:03:27
09 Jun 2016 15:03:27 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