Element - Cascading Dropdown: How to sort the item order..

Unlike some of the other elements (e.g. databasejoin) that have a 'Joins where and/or order by statement (SQL) option, the Cascading Dropdown element only has the Advanced tab with a 'Where query'.

So - if you are needing to get the dropdown items to be presented in ascending/descending order and use the fragment 'order by id asc' (for example), an SQL error will be generated, of the form 'WHERE .. AND order by id asc'.

Obviously, what is happening is that the query builder is expecting a subsequent part of statement that can be ANDed with the prior part of the built statement.

Work around:

I found the following is a simple work around:

'id > 0 order by <column name> ASC'

The ' id > 0' will always be true. So the 'order by <column name> will slip through and be correctly interpreted as part of the statement.

Alastair
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top