Hide past date...

umekolle3

New Member
Is it possible to make the table to hide past date (the rows including date that has already past the actual date) through filtering?

I would like the users to have a choice to only see the upcoming events in the table!
 
You should be able to do this with a table filter, using a subquery (which means you'll have to be using the SVN version, as this was added since the last ZIP was built).

The problem is, you can't do straight '<' or ,'>' logic on MySQL dates, you have to use the MySQL date calc functions. And we don't (yet) provide any pre-built options for that. But luckily we can work round this with a subquery. So set your filter up thusly:

FIELD: your_primary_key
Condition: IN
Value: SELECT your_primary_key FROM your_table_name WHERE DATEDIFF(your_date_element,CURDATE()) >= 0
Eval: subquery

Although in SQL terms, this is slightly inefficient, it should work just fine. I tested it on my server, seems to work OK.

This should give you all rows where your_date_element is set to todays date or greater. If you don't want to include 'today', make it > 0 instead of >= 0.

-- hugh
 
Hey Hugh,

I'm trying to do this with a list of events and I've tried the fix you've posted above but it doesn't seem to be happy with that (breaks the whole site with an error message that looks like it's not finding the right database table)

Is this solution still current? and if so in the 'Value' is it ok to put SELECT Date FROM events WHERE DATEDIFF(Date,CURDATE()) >= 0

events = database table
Date = field that I want it to filter by

or do I have to put events___Date in that last part?

Cheers,
Mandie
 
You are posting in a 4-year-old fabrik1.0 thread:eek:
The prefilter should do, but you must select your primary key (usually 'id' in fabrik), so

FIELD: id
Condition: IN
Value:SELECT id FROM events WHERE DATEDIFF(Date,CURDATE()) >= 0
Type: query

id and Date are your (short) element names (= column names in your MySQL database table)
 
ahhh Troester you're a lifesaver when my stupidity appears to have no bounds ... but that didn't work - it doesn't show any data at all with that filter in place


and incidentally I should have posted this in Fabrik 2.0 .. ugh >.<
 
What are your prefilter settings?

I assume you are using fabrik2 (Joomla1.5), not fabrik3?
 
We are in need of some funding.
More details.

Thank you.

Staff online

Members online

Back
Top