Sorting on Alias

More
8 years 6 months ago #62411 by Ninjakitten
Replied by Ninjakitten on topic Sorting on Alias
I've done a bit more poking around... it looks to me as though in order to have items without the custom date (which primary ordering is done by) show up last, the change would have to be in the buildItemOrderBy helper function. Maybe adding an option so that the ORDER BY could be constructed to do something like ORDER BY (custom_field IS NULL), custom_field ASC <etc>?

At any rate, it doesn't look like something I can arrange without hacking at the FC files, which I do try to avoid. ;) I could theoretically clone the flexiadvsearch plugin and adjust that, I suppose, but I'd hate to miss out on any new changes. So it looks like it would actually be a separate feature request, really -- maybe I should make a new topic for that.

Please Log in or Create an account to join the conversation.

More
8 years 6 months ago - 8 years 6 months ago #62434 by ggppdk
Replied by ggppdk on topic Sorting on Alias
Hello

-- all built-in fields, that do not have a value for a field
will not store a row in the field values TABLE !!

Thus to place these last regardless of ASC / DESC order direction,

it is enough to prepend to the custom field order this:
ISNULL(cf.value),

aka the custom date ordering AND other custom field orderings will look like:
ISNULL(f.value), CAST(f.value AS DATE)

because you will these items to be last even for the DESC case:

please see example of items with no date being placed last

0, '2012-04-25'
0, '2012-04-22'
0, '2012-04-20'
0, '2012-04-17'
1, ''
1, ''
1, ''

The above change should not create any performance difference,
- thus i think to add IF it is arguably the always the correct behaviour ???


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...
Last edit: 8 years 6 months ago by ggppdk.

Please Log in or Create an account to join the conversation.

More
8 years 6 months ago #62435 by ggppdk
Replied by ggppdk on topic Sorting on Alias
Hello

or do you mean that
- 2nd level order is custom field (date field)
and you want in the case that it does not have date value to
... place the items last regardless of 1st level order ?


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
8 years 6 months ago #62458 by Ninjakitten
Replied by Ninjakitten on topic Sorting on Alias
I mean the first level, so the first one's right. :)

I do think that it makes more sense for the nulls to be at the end of their sort by default -- it would be extra nice if there were a setting so people could pick whether they wanted the nulls at the end or the beginning, but I would put them at the end by default myself.

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.385 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline