Okay
  Public Ticket #3022742
filters doesn't work
Closed

Comments

  • Pierre-Eloi started the conversation

    Hello,

    Sorry for my english, I'm french.

    I created a table with a sql query :

    SELECT ID, DATE_FORMAT(post_date, "%d/%m/%Y %H:%i:%s") AS date, (
        SELECT meta_value
        FROM jc_postmeta 
        WHERE post_id = jc_posts.id 
        AND meta_key = '_field_email'
    ) AS email, (
        SELECT
            CASE
                WHEN meta_value LIKE '%Non%' THEN 'Non'
                WHEN meta_value LIKE '%Oui%' THEN 'Oui'
                ELSE ''
            END
        FROM jc_postmeta 
        WHERE post_id = jc_posts.id 
        AND meta_key = '_field_souscription'
    ) AS souscription, (
        SELECT meta_value
        FROM jc_postmeta 
        WHERE post_id = jc_posts.id 
        AND meta_key = '_field_civilite'
    ) AS civilite, (
        SELECT meta_value
        FROM jc_postmeta 
        WHERE post_id = jc_posts.id 
        AND meta_key = '_field_nom'
    ) AS nom, (
        SELECT meta_value
        FROM jc_postmeta 
        WHERE post_id = jc_posts.id 
        AND meta_key = '_field_prenom'
    ) AS prenom, (
        SELECT meta_value
        FROM jc_postmeta 
        WHERE post_id = jc_posts.id 
        AND meta_key = '_field_adresse_1'
    ) AS adresse_1, (
        SELECT meta_value
        FROM jc_postmeta 
        WHERE post_id = jc_posts.id 
        AND meta_key = '_field_adresse_2'
    ) AS adresse_2, (
        SELECT meta_value
        FROM jc_postmeta 
        WHERE post_id = jc_posts.id 
        AND meta_key = '_field_code_postal'
    ) AS code_postal, (
        SELECT meta_value
        FROM jc_postmeta 
        WHERE post_id = jc_posts.id 
        AND meta_key = '_field_ville'
    ) AS ville, (
        SELECT meta_value
        FROM jc_postmeta 
        WHERE post_id = jc_posts.id 
        AND meta_key = '_field_telephone'
    ) AS telephone, (
        SELECT
            CASE
                WHEN meta_value LIKE '%Non%' THEN 'Non'
                WHEN meta_value LIKE '%Oui%' THEN 'Oui'
                ELSE ''
            END
        FROM jc_postmeta 
        WHERE post_id = jc_posts.id 
        AND meta_key = '_field_client_jardicoop'
    ) AS client_jardicoop, (
        SELECT meta_value
        FROM jc_postmeta 
        WHERE post_id = jc_posts.id 
        AND meta_key = '_field_code_client'
    ) AS code_client, (
        SELECT
            CASE
                WHEN meta_value LIKE '%Non%' THEN 'Non'
                WHEN meta_value LIKE '%Oui%' THEN 'Oui'
                ELSE ''
            END
        FROM jc_postmeta 
        WHERE post_id = jc_posts.id 
        AND meta_key = '_field_compte_urssaf'
    ) AS compte_urssaf, (
        SELECT meta_value
        FROM jc_postmeta 
        WHERE post_id = jc_posts.id 
        AND meta_key = '_field_numero_urssaf'
    ) AS numero_urssaf
    FROM jc_posts
    WHERE jc_posts.post_type = 'flamingo_inbound'
    AND jc_posts.post_content LIKE '%credit-impot-instantane%'
    ORDER BY jc_posts.id DESC

    But when I try to filter these datas (whatever I filter), the result is always the same : "Aucun élément à afficher" (no result). Even the search input, without the Powerful Filter add-on, doesn't work.

    Where is the problem ?

    Thanks for your help

    Bests regards

    Pierre

  •  1,846
    Miloš replied

    Hi, Pierre

    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.

    -

    I can see that there is a similar ticket to this one, and 7 hours ago you wrote it is resolved.

    But i am not sure if it is the exact same issue.

    If you have issues with an SQL query presenting the data in our plugin, but the filtering does not work, please read these important informations:

    -

    In some situations, using certain functions within SQL, the wpDataTables server has problems with parsing the query and building new queries dynamically (rarely happens, but does sometimes).

    Our logic is based on a PHP SQL parser which has full support for the SQL dialect for the following statement types

    SELECT, INSERT, UPDATE, DELETE, REPLACE, RENAME, SHOW, SET, DROP, CREATE INDEX, CREATE TABLE, EXPLAIN and DESCRIBE.

    Some of them are disabled for security reasons.

    Filtering, sorting, calculation functions and search may not work properly if you include:

    Accent graves ( ` ) around the table name JOIN functions UNION functions CONCAT functions sub-queries -

    • Please do not use “LIMIT” in the SELECT statement. wpDataTables adds it automatically and it will be overridden.
    • Please do not use “ORDER BY” in the SELECT statement. wpDataTables has its own sorting engine so it makes no sense to use MySQL’s sorting, since it will be overridden. Also, server-side processing feature adds this part of statement automatically when users trigger the sorting on the front-end, and having it in initial statement may cause the table to crash.

    -

    To avoid this, can you please prepare a MySQL view (a stored query), which will return the data that you need, call it e.g. “view1” and then build a wpDataTabled based on a simple query like “SELECT * FROM view1″.

    - If you need help creating a View and use it with our plugin, here is our video with an example.

    Let us know if this helped.


    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

  • Pierre-Eloi replied

    Hello Miloš,

     Thanks for your reply. Finally, I've unchecked "Enable server-side processing" and it's good ! I can filter my table.

    Thanks again

    Bests regards

    Pierre

  •  1,846
    Miloš replied

    Hi, Pierre

    You're welcome, glad to be able to help in any way.smile.png

    If anything else happens, please don't hesitate to open a new ticket. Thank you.

    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