Okay
  Public Ticket #1733335
Sum Columns
Closed

Comments

  •  2
    jko5er started the conversation

    Hello,

    Is anyone having issues with the sum row in wpdatatables? My specific table has 140,000 rows and Server-side processing enabled. I have a column named ValCount defined as [Decimal(10,2)]. Most values in the column are positive and some are negative (with a negative, "-" before the value). The mysql query looks like this: 

    Select SUM(ValCount) from TableA

    The above query = 113497540.88

    When I set wpdatatables to include the sum row in the table, it calculates it wrong. 114206591.59

    Is there something I am doing wrong? Or is the calculation failing in wpdatatables?

  •  471
    Isidora replied

    Hi jko5er,
    Thank you for your purchase.

    If your MySQL-query based wpDataTable doesn’t work correctly with server-side processing, probably this is happening because wpDataTables server has problems with parsing of the query and building new queries dynamically (happens rarely, but does sometimes). To avoid this 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″.

    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

  •  2
    jko5er replied

    Hi Milan,

    I did create a view in MySQL and it yields the same incorrect results. No difference.

    My data type is decimal(10,2) and wpdatatables column type is Float. Does the sum only work properly with integers?

  •  471
    Isidora replied

    HI jko5er,

    Yes it should be working with floats also.

    Can you please tell me do you use accent grave (`) in that view?(SELECT * FROM `view_name`)

    From version 2.3 we implement feature that you can use multiply separate db connections for (MySQL,MSSQL and PostgreSQL) and for MySQL engine we are dynamically adding accent grave (`), so if you are using it please remove it from query and it should be working fine.

    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

  •  2
    jko5er replied

    I just did remove the accent grave from my view name in wpdatatables and it did not change. 

    Is there something else I can test? Again, this column has positive and negative values. It’s almost as if the calculation is ignoring the negatives, and counting those as positives. Could that be possible?


  •  2
    jko5er replied

    Milan, sorry for the troubles... I found an invalid value in my database. It had "-" and also () to indicate negative.

    Once I corrected it to remove the (), it worked.


    Thank you for such a great product! You may close this.

  •  471
    Isidora replied

    Hi jko5er,

    You are welcome.

    I am glad that you found what cause the issue.

    If you have any more issues or questions feel free to open a new ticket, we will gladly help.

    We'd greatly appreciate it if you could take a minute and leave a Review on CodeCanyon on this link. Thanks! 

    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