Page 1 of 1

Sort Orders/Field Filtering

PostPosted: Sat Oct 01, 2005 7:22 am
by bozoka45
I think one of the advances that needs to be made with the next version/update is an updated Sortin and Filtering section. At the moment, news items can only be limited on number by time and PerlCode needs to be used to arrive at the desired effect. I believe we need a MySQL-like filtering and sorting system. I don't mean using MySQL, but I meaning using their methods. With SQL, you can specify multiple fields meeting multiple requirements, and then order them by any number of fiends, and limit the results to a certain amount.

If anyone requires any examples, I'll be happy to supply some.

PostPosted: Sun Oct 02, 2005 10:22 am
by bozoka45
Just had a really, really cool idea that came to mind and wanted to write it down somewhere before going to sleep for the night. This is more of an addon that I'll most probably be developing rather than a core request, but it's interesting. I want to allow users to enter an SQL command and use that in place of the normal filterting and sorting done by Coranto.

Unfortunately only advanced users might be able to benefit, but SQL is well documented and explained around the web, which hopefully make it more beneficial to people.

PostPosted: Sun Oct 02, 2005 4:48 pm
by SrNupsen
Hm. I agree to the benfit of flexibility, but you might just as well present users with a dropdown list of possible commands. Reason? If you allow users to enter their own SQL commands you will have to do MAJOR security checking.

SrNupsen

Re: Sort Orders/Field Filtering

PostPosted: Sun Oct 02, 2005 7:43 pm
by Parahead
bozoka45 wrote:I think one of the advances that needs to be made with the next version/update is an updated Sortin and Filtering section. At the moment, news items can only be limited on number by time and PerlCode needs to be used to arrive at the desired effect.
The Profile Numeric Filter addon was created to allow users to do Filter -> Sorting as well as Sorting -> Filtering. For more demanding sorting needs you have the SortOrders addon (could be improved though, as mentioned here) and the FilterByField addon for filtering... Using these addons together you should be able to do what you want?

Sidenote: the Profile Numeric Filter addon is modifing the core to some extent to do its stuff, so I have thought about integrating that functionality into the 1.31.x core instead.

PostPosted: Sun Oct 02, 2005 7:56 pm
by bozoka45
SrNupsen wrote:Hm. I agree to the benfit of flexibility, but you might just as well present users with a dropdown list of possible commands. Reason? If you allow users to enter their own SQL commands you will have to do MAJOR security checking.

SrNupsen


As with my SQLSearch addon, users would only be able to start a query with

Code: Select all
SELECT * FROM CORANTO_DB


It's hard coded into the addon so there's really not a way around it. Also, if the SQL entry box appears on a profile page, then it will only be available to administrators. Do you think that would cover most security?

Code: Select all
The Profile Numeric Filter addon was created to allow users to do Filter -> Sorting as well as Sorting -> Filtering. For more demanding sorting needs you have the SortOrders addon (could be improved though, as mentioned here) and the FilterByField addon for filtering... Using these addons together you should be able to do what you want?


Ah..I knew there was an addon that allowed to change the order of sort vs filter, I just couldn't find it (Even after looking at your site). I am using SortOrders and FilterByField already. One thing to mention is that this would expand both addons, as you could filter by an unlimited amount of fields and sort by an unlimited amount of fields.

PostPosted: Sun Oct 02, 2005 8:31 pm
by Parahead
bozoka45 wrote:Ah..I knew there was an addon that allowed to change the order of sort vs filter, I just couldn't find it (Even after looking at your site). I am using SortOrders and FilterByField already.
Sorry. And I agree, the name of that addon isn't that good. Well, if the functionality is incorporated into the core, it doesn't matter any more... ;-)

bozoka45 wrote:One thing to mention is that this would expand both addons, as you could filter by an unlimited amount of fields and sort by an unlimited amount of fields.
True. But is the demand for this that big? To my knowledge there has been no requests to be able to sort by or filter on more than two fields? Extending the SortOrders and FilterByField addons to add new input fields dynamically when the first ones has been filled would achive the same effect and would be much simpler than creating a "SELECT * FROM CORANTO_DB"-addon? How often do you you create SELECT-statements that uses SORT BY with more than two fields?

PostPosted: Mon Oct 03, 2005 12:14 am
by bozoka45
Parahead wrote:True. But is the demand for this that big? To my knowledge there has been no requests to be able to sort by or filter on more than two fields? Extending the SortOrders and FilterByField addons to add new input fields dynamically when the first ones has been filled would achive the same effect and would be much simpler than creating a "SELECT * FROM CORANTO_DB"-addon? How often do you you create SELECT-statements that uses SORT BY with more than two fields?


There's not alot of demand for alot of the addons I write, I mostly write them for myself. This is something that would be much easier on me. Anyway, looking at the code for build news I'm not quite sure how possible it will be.

PostPosted: Mon Oct 03, 2005 7:33 am
by Parahead
bozoka45 wrote:There's not alot of demand for alot of the addons I write, I mostly write them for myself. This is something that would be much easier on me. Anyway, looking at the code for build news I'm not quite sure how possible it will be.
Aha, OK... Sorry, I thought this was a more general request and discussion. Still, I think that the three addons I mentioned above do fulfill your request, however slightly limited at the moment with only being able to filter/sort on two fields (maybe coverring ~95% of most users need?), but improving them to allow more fields would basically cover even your needs, right?

I just feel that using those addons are a little more userfriendly than having to specify a SQL query? Also, you would need to extend the SQL syntax slightly to let you specify if numeric, alphabetical or true alphabetical sorting should be performed on each individual field (as well has handling Ascending/Descending sorting).

PostPosted: Mon Oct 03, 2005 7:46 am
by bozoka45
I like the idea, if you've seen my SQLSearch I'd like to base it on that, except have it build news rather than use it to search through news.