Okay
  Public Ticket #2936652
Sum not working
Closed

Comments

  • Chuck Czarnecki started the conversation

    The Sum is showing 0.00 for a float column with 27,500.00 and 14,450.  When I Save Changes the correct sum appears and disappears within a second.  Any suggestions?

  • [deleted] replied

    Hi Chuck

    Thank you for reaching out to us.

    Can you please tell us how was this table created and can you share the source file with us (just remember to click on private reply) so we can try and recreate the issue on our end? 

    If it is an SQL table have you tried creating an SQL view from the original query and creating a table from the view? 

    Do you see the same behavior both on the backend and the front? Is the column saved as float in the database as well? Do you have the same number format in the source file as it is in wpDataTables 

    3655173898.png

    Have you installed any other plugin recently and is our plugin updated to the latest version?

    Any screenshot, screen recording or additional information you can think of will help us resolve this fastersmile.png

  • Chuck Czarnecki replied

    Thanks for responding.  The view works!  The query is a select Name, 365*Quantity FROM, WHERE ...

    I'm trying to sum the 365*Quantity.  The data is the table is great but the sum is 0.0  Interesting when the table loads the sum is correct for a second and then goes to 0.0

    Chuck

  • [deleted] replied

    Hi Chuck

    Honestly I'm a bit confused, did the view solve the issue? If yes, great I'm glad to hear thatsmile.png

    If not, we will be happy to troubleshoot it further.

  • Chuck replied

    The view is a very poor workaround since I will need over 50 views.  I was hoping to have the query work, but apparently it can't do a sum 365*Quantity (although the correct answer appears then disappears to 0.0)

  •  2,572
    Aleksandar replied

    Hello Chuck

    wpDataTables is not a database management plugin, so it can't perform as well as phpMyAdmin, or any other database management tool performs. We use a 3rd party PHP SQL parser which is quite limited.

    For example, it 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 the listed statments are disabled for security reasons.

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

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

    Sorry for the inconvenience.

    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

  • johnrg1980 replied

    Hi,

    I just wanted to add to this post. I full appreciate your response this the SUM function is not available with joins, however, your plugin does work out the correct information, it displays it, then a second later refreshes the data and then it is displayed as 0.

    Happy to share more of the output, but the data is visible in the console when the Reponses are viewed, specifically within the wdtHTML element.

    In the admin response:

    wp-admin/admin-ajax.php?_fs_blog_admin=true

    <!-- Table footer -->\n \n <tfoot>\n <tr class=\"wdt-sum-row\">\n <td class=\"wdt-sum-cell\" data-column_header=\"varStoreName\"\n style=\"\">\n </td>\n <td class=\"wdt-sum-cell\" data-column_header=\"Order count\"\n style=\"\">\n Total 25 </td>\n <td class=\"wdt-sum-cell\" data-column_header=\"value\"\n style=\"\">\n Total 765.45 </td>\n </tr>\n </tfoot>\n <!-- /Table footer -->\n\n </table>

    But then in the next response, the data is 0 which overwrites the returned HTML data.

    1305301690.png

    So something does calculate the correct numbers, but it's then over written.

    Cheers,


  •  2,572
    Aleksandar replied

    Hello there.

    Thank you for reaching out to us.

    For server-side tables, the server-side logic works for everything (editing, pulling the data, filtering, sorting...), so if you have a bit more complex query, it's likely that the real value won't be returned.

    What server-side logic is displaying is a part of the logic that renders HTML and table description, which load first on the page, and after that, it's filled with server-side logic.

    If you have less than 2.000 rows, you would be able to turn off Server-side processing for MySQL query-based tables, but in that case, you would lose the editing option.

    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