Hello,

I tried to make a view to show activity of users on a website like this:

1) User X just posted an article - 12 APR 2012 - 07:50
2) User X just posted a comment - 12 APR 2012 - 07:51
3) User X just posted a comment - 12 APR 2012 - 07:52
4) User X just posted an article - 12 APR 2012 - 07:53

In VIEWS 3 you can sort them only like this:

1) User X just posted an article - 12 APR 2012 - 07:50
4) User X just posted an article - 12 APR 2012 - 07:53
2) User X just posted a comment - 12 APR 2012 - 07:51
3) User X just posted a comment - 12 APR 2012 - 07:52

What I basically need is a sort by date for 'comments' and 'articles' in the same view (view in view with sorting)!
Can this be achieved in VIEWS 3? I think this would be a very cool future.

Many thanks for help with this.

Comments

merlinofchaos’s picture

Status: Active » Fixed

This is particularly difficult to do, because what you're trying to do is merge two different fields and then sort by the pair.

In SQL, the way you have to do this is with a command called COALESCE, where you do this:

...ORDER BY COALESCE(table1.date, table2.date);

Views doesn't natively support doing that. You would have to write your own sort handler to do something like that.

Presumably whatever you're using to record the activity also has its own timestamp, so you should be able to sort like that. I have no idea what module it is that you've got doing that.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.