1

I have a field 1 Name and another field 2 Year and have it sorted in Views first by Name and second by Year. If Year is empty I want it to be placed last under each letter. So lets say I have 5 James in my list and 4 of them have a Year and the one without Year to appear last in the list of those names but before Jane.

I've installed Rules and Views Rules but I don't know how use Rules for this kind of thing. Any suggestions?

1 Answer 1

0

Assuming that the Name field is text and the Year field is an integer, if you sort the Names ascending and the Years descending, the empty year of James should come last and before Jane (which should be what you are after). That's the default behavior of Views. If your views has contextual filters or relationships, you may be getting different results.

In any case, you can configure the Year field and under the "No Results Behavior" you can set a very low (or high depending on what you want) value for year and hide it. This way, you will guarantee that it will be sorted as expected.

Screenshot for reference

1
  • Name is an Entity Reference that I sort first and then comes Year which is an integer. I put "No Results Behavior" for Year to 2050 but it still ends up first. And second, where do I hide "No Results Behavior"? All I can see if "Hide if Empty".
    – disallgbg
    Commented Jul 22, 2014 at 17:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.