1. Hugh is now back at work, more or less full time, after a slower than expected recovery from his neck surgery early this month. Obviously we have a backlog of support to clear, and are working as hard as we can to take care of it. If you have an unanswered thread more than 3 days old, please post one (and only one) "bump" on it, to move it in to our "last 3 days" list. If you have an unanswered issue in a forum you no longer have access to due to subscriptions timing out, please use the Contact Us form, and provide us with the URL to the thread.

Hide past date...

Discussion in 'Subscriber Support' started by umekolle3, Jul 25, 2008.

  1. umekolle3 New Member

    Level: Standard
    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!
  2. cheesegrits Support Gopher

    Level: Community
    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
  3. Mandie New Member

    Level: Community
    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
  4. troester Well-Known Member

    Level: Standard
    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)
    1 person likes this.
  5. Mandie New Member

    Level: Community
    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 >.<
  6. troester Well-Known Member

    Level: Standard
    What are your prefilter settings?

    I assume you are using fabrik2 (Joomla1.5), not fabrik3?

Share This Page