1. Important notice about Cloudbleed - if your site uses the Cloudflare CDN, and you intend to follow the Joomla security team's advice to change your site "secret", you MUST READ THIS NOTICE.
  2. Fabrik 3.6 Released Remember to backup and test your backup before proceeding with this update. Please report any problems you might experience with this new version here on the forum. You are safe to upgrade to Joomla! 3.7 and PHP 7.x with this version of Fabrik. View the blog for more details on this release.

Hide past date...

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

  1. umekolle3

    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

    cheesegrits Support Gopher Staff Member

    Level: Supporter
    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

    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?

  4. troester

    troester Well-Known Member Staff 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

    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

    troester Well-Known Member Staff Member

    Level: Standard
    What are your prefilter settings?

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

Share This Page