Okay
  Public Ticket #1798832
Selection of record from SQL database
Closed

Comments

  • cjm007 started the conversation

    Hello.

    I recently bought your Plugin. Looks great, but I have a problem.

    Previously I used DBVIEW and had a query to select the number of records within ranges of years

    Year      Number

    <1982           2

    1982-1985   5

    etc..

    I use this query:

    SELECT "<1982" AS Lidsinds
    , COUNT(meta_value) AS Aantal
    FROM wp_usermeta
    WHERE meta_key = 'lidsinds' and substr(meta_value,7,4) BETWEEN 0 AND 1981
    GROUP BY Lidsinds
    UNION ALL
    SELECT "1982-1985" AS Lidsinds
    , COUNT(meta_value) AS Aantal
    FROM wp_usermeta
    WHERE meta_key = 'lidsinds' and substr(meta_value,7,4) BETWEEN 1982 AND 1985
    GROUP BY Lidsinds
    UNION ALL
    SELECT "1986-1990" AS Lidsinds
    , COUNT(meta_value) AS Aantal
    FROM wp_usermeta
    WHERE meta_key = 'lidsinds' and substr(meta_value,7,4) BETWEEN 1986 AND 1990
    GROUP BY Lidsinds

    etc...

    I works fine.

    With wpDatatables this is not possible. I get the error:

    cannot calculate position of (meta_value) within UNION SELECT user_id,'<1982', COUNT(meta_value) FROM wp_usermeta WHERE meta_key = 'lidsinds' and substr(meta_value,7,4) BETWEEN 0 AND 1981 GROUP BY Lidsinds


    Please help.

    Best regards, Kees


  •  471
    Isidora replied

    Hi cjm007,
    Thank you for your purchase.

    If you don't have sensitive data can you please send me tables that you use in that query and also a hole query, so we can investigate in our local environment?

    Best regards.

    Kind Regards, 

    Isidora Markovic

    wpDataTables: FAQFacebookTwitterFront-end and back-end demoDocs

    Amelia: FAQFacebookTwitter |  Amelia demo sites | Docs

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

    Powerful FiltersGravity Forms Integration for wpDataTablesFormidable Forms Integration for wpDataTables

  • cjm007 replied

    Hi Milan.

    I use tabel wp_usermeta with fields: meta_key="Lidsinds" and meta_value is a date in string format. 

    The selection is:

    SELECT "<1982" AS Lidsinds
    , COUNT(meta_value) AS Aantal
    FROM wp_usermeta
    WHERE meta_key = 'lidsinds' and substr(meta_value,7,4) BETWEEN 0 AND 1981
    GROUP BY Lidsinds
    UNION ALL
    SELECT "1982-1985" AS Lidsinds
    , COUNT(meta_value) AS Aantal
    FROM wp_usermeta
    WHERE meta_key = 'lidsinds' and substr(meta_value,7,4) BETWEEN 1982 AND 1985
    GROUP BY Lidsinds
    UNION ALL
    SELECT "1986-1990" AS Lidsinds
    , COUNT(meta_value) AS Aantal
    FROM wp_usermeta
    WHERE meta_key = 'lidsinds' and substr(meta_value,7,4) BETWEEN 1986 AND 1990
    GROUP BY Lidsinds
    UNION ALL
    SELECT "1991-1995" AS Lidsinds
    , COUNT(meta_value) AS Aantal
    FROM wp_usermeta
    WHERE meta_key = 'lidsinds' and substr(meta_value,7,4) BETWEEN 1991 AND 1995
    GROUP BY Lidsinds
    UNION ALL
    SELECT "1996-2000" AS Lidsinds
    , COUNT(meta_value) AS Aantal
    FROM wp_usermeta
    WHERE meta_key = 'lidsinds' and substr(meta_value,7,4) BETWEEN 1996 AND 2000
    GROUP BY Lidsinds
    UNION ALL
    SELECT "2001-2005" AS Lidsinds
    , COUNT(meta_value) AS Aantal
    FROM wp_usermeta
    WHERE meta_key = 'lidsinds' and substr(meta_value,7,4) BETWEEN 2001 AND 2005
    GROUP BY Lidsinds
    UNION ALL
    SELECT "2006-2010" AS Lidsinds
    , COUNT(meta_value) AS Aantal
    FROM wp_usermeta
    WHERE meta_key = 'lidsinds' and substr(meta_value,7,4) BETWEEN 2006 AND 2010
    GROUP BY Lidsinds
    UNION ALL
    SELECT "2011-2016" AS Lidsinds
    , COUNT(meta_value) AS Aantal
    FROM wp_usermeta
    WHERE meta_key = 'lidsinds' and substr(meta_value,7,4) BETWEEN 2011 AND 2016
    GROUP BY Lidsinds

    It should produce:

    LidsindsAantal
    <1982 31
    1982-1985 9
    1986-1990 23
    1991-1995 18
    1996-2000 39
    2001-2005 45
    2006-2010 84
    2011-2016 115


    Hope this is enough information. For the time being A created a view in phpadmin and call that one in wpDataTables

    By the way. I tested everything in a local wordpress instance. Sometimes after saving, nothing happend and I had to open or create the datatable again to proceed.   

    I created a datatable today in my productive site and after saving the site opened an empty screen and I could not do anything anymore. My wp-admin was also unavailable. I tried to rename the plugin directory in filezilla,  but this was not possible. I thing the plugin had the directory locked. Does this sound familiar.


    best regards, Kees Bond.



  •  471
    Isidora replied

    Hi Kees,

    No, that is the first time that we get such feedback from our customers. Did you check your server log to figure out what is going on?

    We can't reproduce the issue without your tables that you use in database. Is it possible to export those tables and send us, so we can investigate in our local environment?


    Kind Regards, 

    Isidora Markovic

    wpDataTables: FAQFacebookTwitterFront-end and back-end demoDocs

    Amelia: FAQFacebookTwitter |  Amelia demo sites | Docs

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

    Powerful FiltersGravity Forms Integration for wpDataTablesFormidable Forms Integration for wpDataTables

  •   cjm007 replied privately
  •  471
    Isidora replied

    Hi Kees,

    Unfortunately, we can't use this because it won't be the same settings of the tables like in your environment and also you use table wp_usermeta that have data that you use in query.

    I am glad that your tables made from view are working fine now.

    I will close this one.

    Best regards.


    Kind Regards, 

    Isidora Markovic

    wpDataTables: FAQFacebookTwitterFront-end and back-end demoDocs

    Amelia: FAQFacebookTwitter |  Amelia demo sites | Docs

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

    Powerful FiltersGravity Forms Integration for wpDataTablesFormidable Forms Integration for wpDataTables

  • cjm007 replied

    Hi Milan.

    I found another issue. When I edit a line from a table, the text "Edit Entry" at the top is not translated. And at the bottom the text "Apply and new " is not translated too. I would prefer to use "Opslaan" instead of "Ok". See attachments


    Best regards, Kees

  •  471
    Isidora replied

    Hi Kees,

    Strings like "Edit Entry" and "Add new Entry" are generated with javascript so you have to change it manually in file wp-content/plugins/wpdatatables/assets/js/wpdatatables/wpdatatables.js around line 1088 you will find this

    modal.find('.modal-title').html('Edit entry');
    

    and in same file around line 1088 you will find this

    modal.find('.modal-title').html('Add new entry');

    where you can change those sting like you need.

    String "Apply and new" should be translated becasue it is wrap with special function in wordpress for translating strings. You can find it in file 
    wp-content/plugins/wpdatatables/templates/frontend/edit_dialog.inc.php around line 167 you will find this

    <?php _e('Apply and add new', 'wpdatatables'); ?>

    where you can change it like you need.

    About the future questions:

    When you are posting on ticket that are not yours or have questions or issues which are not related to the title of the active ticket can you please open a new one, and we will help you there. In that way, issues and questions which are related to different subjects will be in different tickets so other customers or our support agents can find it easily. Our policy is to have one issue or question per ticket because of the reasons that is described already.

    Thank you for understanding.

    Best regards.

    Kind Regards, 

    Isidora Markovic

    wpDataTables: FAQFacebookTwitterFront-end and back-end demoDocs

    Amelia: FAQFacebookTwitter |  Amelia demo sites | Docs

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

    Powerful FiltersGravity Forms Integration for wpDataTablesFormidable Forms Integration for wpDataTables