Okay
  Public Ticket #2638607
Convert_TZ and Server Side Processing
Closed

Comments

  • David Gruhin started the conversation

    I am ingesting a JSON feed using WP All Import. It brings in the date at UTC and I would like to display it in Eastern Time -5 hours.

    Using a select query I get the result time I am expecting, however I can then no longer sort the table or filter without all the data disappearing, unless I disable server side processing, which unfortunately is not reasonable due to the number of records.

    Any suggestions would be greatly appreciated and I would like to keep the solution on the SQL side if possible.

    SELECT wp_cdr_logs.`post_id`,

           wp_cdr_logs.`call_id`,
           wp_cdr_logs.`dest_name`,
           wp_cdr_logs.`dest_number`,
           wp_cdr_logs.`inbound_did`,
           wp_cdr_logs.`did_description`,
           wp_cdr_logs.`went_to_voicemail`,
           wp_cdr_logs.`dest_event`,
           wp_cdr_logs.`id`,

           CONVERT_TZ(wp_cdr_logs.`date_time`,'UTC','America/Detroit'),

           wp_cdr_logs.`origin_number`,
           wp_cdr_logs.`origin_name`,
           wp_cdr_logs.`origin_event`,
           wp_cdr_logs.`durationInSeconds`
    FROM wp_cdr_logs
    WHERE 1=1 
       AND wp_cdr_logs.`origin_event` = 'Dial-Out Domestic'
       AND wp_cdr_logs.`origin_number` = '1227'


  •  2,498
    Aleksandar replied

    Hello David

    Thank you for reaching out to us. Since you have access to SQL query based tables, you obviously have the full version of the plugin. Can I ask you to open tickets in the wpDataTables section, as Pre-purchase section is reserved for users that still haven't purchased the plugin?

    Thank you in advance.

    These queries will not work because they are too complex for the PHP SQL parser we use. You can prepare a MySQL view (a stored query), which will return the data that you need, call it e.g. “view1” and then build a wpDataTable based on a simple query like “SELECT * FROM view1″.

    Please note some this when working with the server-side processing feature:

    • 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.

    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    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