I want to filter my "events" view by those which occur today or and day after today. But when I set Event:Event Start >= now - I still get all the events old and upcoming. Help please!

Comments

crystaldawn’s picture

Use this instead maybe? Event: Event Start >= +1 day or Event: Event Start >= +0 day. I believe the DB abstract layer does not allow now() to be used. I dont know why but I encountered that problem in a different module once as well (queryable variables) where it wouldnt allow now() to be passed into the query. So it's probably not seeing now() as a value or just leaves it out which would result in it showing everything. This is actually a DB abstract "feature" or lack of imho. All DB's support the now syntax so I have no idea why drupal's db abstract layer doesnt allow it.

flippinsweet’s picture

Thanks crystaldawn, but even with each of those examples I still get all the events. If you look at the query it seems to be that the numerical value for event.unix_event_start does omits time(?) as opposed to the value in the db.

crystaldawn’s picture

The timestamp is a unix timestamp that can be used with views in date format yes. It shouldnt ever display the actual timestamp itself as thats just a raw value in the DB. You should always see it as a date/time lookin thing. I just tried it on my test server and it appeared to work correctly. I had 3 events, 2 in the past 1 in the future and with +1 day it showed just the future event in my view.

Here is the query that mine outputs and it works just fine:

$query = "SELECT node.nid AS nid, node.title AS node_title, event.unix_event_start AS event_unix_event_start FROM node node  LEFT JOIN event event ON node.nid = event.nid WHERE event.unix_event_start >= ***CURRENT_TIME***+86400 ORDER BY event_unix_event_start ASC";

So if your view shows something other than future events, then there is something else causing it to display everything. Compare your query with mine and look for any differences and then figure out why there is a difference.

flippinsweet’s picture

Thanks again...here's my query:

SELECT node.title AS node_title,
node.nid AS nid,
DATE_FORMAT((FROM_UNIXTIME(event.unix_event_start) + INTERVAL -14400 SECOND), '%Y%m%d%H') AS event_unix_event_start_hour
 FROM node node 
 LEFT JOIN event event ON node.nid = event.nid
 WHERE (event.unix_event_start >= 86400) AND (node.type in ('event')) AND (node.status <> 0)
   ORDER BY event_unix_event_start_hour ASC

It appears different, but I'm no expert. Thoughts?

crystaldawn’s picture

I dont have any idea how you got it to come up with that type of query but I would completely delete the view and start over until you get it to produce the exact same query that mine gives. It's imperative that you use +1 day so that it produces the exact same query. Then once you get it working with that, you can play with it to do other things. It's difficult to work from an unknown starting point. But if you can get it to a starting point that works then you have a base to start from. Then once you find out what was causing it to not work, then it might either be a bug or just user error.

flippinsweet’s picture

Thanks again, I'll delete the view and start over from the top!

--Update--

I started over

I reinstalled the module

Still nothing...it appears to me that it is not pulling the "Current Date/Time" into the query

-Josh

crystaldawn’s picture

I am guessing that you must have some sort of other module, perhaps one that deals in date/time, thats somehow modifying the query. The only other thing I can think of is to start with a clean slate (just drupal, bare minimum views module, events, and event_views), get it working, and then enable each module one at a time to see if thats the problem. I've tried over and over to get it to produce the query you've got here but I cant lol. I'd like to find whats causing this behavior so I could write up a patch for it without writing something in the dark and just guessing. I could probably use query alter to fix it but without knowing why it happens, its likely to happen again.