DMXzone Server Data Formatter Support Product Page


Sorting by a formatted column

Asked 27 Sep 2018 14:52:59
has this question
27 Sep 2018 14:52:59 David Woolley posted:
I have a field with alphanumerics like so:
D1, D2 .... D10, D11, D12 .... etc etc

I need to sort by the number part only, so I thought of using the Sub String formatter like so:
Sort Order in query: {{code_no.substr(1, 2)}}

but this does not show any results - it breaks the query.

Can Server Data Formatter be used like this for a Sort Order column in a query?


Replied 28 Sep 2018 07:59:52
28 Sep 2018 07:59:52 Teodor Kuduschiev replied:
Hello David,
You cannot use formatters in the order column value.
Replied 28 Sep 2018 08:10:35
28 Sep 2018 08:10:35 David Woolley replied:
Thanks Teodor - I do realize that the client should have used alphanumerics like D01 D02 ... D99 in order to sort properly.
Replied 28 Sep 2018 08:13:13
28 Sep 2018 08:13:13 Teodor Kuduschiev replied:
When working with databases you use INT/numeric fields for data sorting. Sorting strings works exactly like on your site currently. You should add a sort column, which is an INT type and sort using it.
Replied 28 Sep 2018 08:18:13
28 Sep 2018 08:18:13 David Woolley replied:
Thanks for this Teodor.
That was my thought as well - I've used this idea for sorting images in a small gallery using an image_sort column.

Reply to this topic