Okay
  Public Ticket #3589746
conditional requirement on table
Closed

Comments

  • Martin started the conversation

    I need to add a filter to the table as it picks up the data from a table in php.  I would like to be kind of dynamic and locate items created within the last 90 days.  I can see there is an option to add a condition so I can use the date field but how do I do something along the lines of >=date(now)+30 etc

  •  1,846
    Miloš replied


    Hi Martin,

    Firstly, I would like to sincerely apologize for the delayed response as we have been experiencing an unusually high number of tickets. I am sorry that it has taken longer than usual to respond to your concern and your patience is highly appreciated.


    1. When it comes to built-on options for "last 30 days", we only have a Date placeholders for a Conditional Rule via our Conditional Formatting Feature.

    2780094989.png
    7671482534.png

    With this feature, you can set various formatting operations – (“What to do when a match is found) :

    2390278664.png


    2. But when it comes to possible filtering like : "Only show the rows that were made in the last 30 days";

    for that Use-Case we don't have a built-in filtering placeholder/ or solution.

    In the built-in placeholders for dynamic filtering, we only have %CURRENT_DATE% ,  %CURRENT_DATETIME% and %CURRENT_TIME% , which can be used either in SQL Queries for SQL based Tables;

    or as pre-defined Column filter values.


    3. When it comes to custom workarounds to achieve something like a filter on a Table to only show the data for dates less than or equal from Today and the last 30 days;

    you can only try with a custom "WHERE" statement in an SQL Query Based Table.

    For example, this Post on StackOverflow seems useful, where a User did a custom SQL Query to call Records between Today and Last 30 Days;

    or this example - Get last 30 days records in MySQL.

    So, if you would use an SQL Query based Table and store your source data from SQL;

    Then, if you can achieve a Query that returns the data as needed directly in your Database Management Tool ( e.g PhPMyAdmin), then you should be able to call the same Query in our SQL Table.

    If our SQL Parser struggles with a complex Query - you can make an SQL VIEW in your DB, then call it in our Table like :  SELECT * FROM ViewName.


    I hope that helps.

    If you wish to see a built-in Placeholder for filtering as "last 30 days" in the future, you can leave a development suggestion.

    Please feel free to search on our suggestions page

     to see if someone may be already suggested this feature. If you can't see it, feel free to add your suggestion there,  and as more people vote, the feature will move higher on the priority list.

    You can certainly follow our changeLog page if you'd like ( it is also available in the plugin dashboard), where we state any changes/new features/bug fixes during updates;

    and our newsletter, so you're informed about new features, bug fixes, freebies, etc.


    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables