Okay
  Public Ticket #3332471
Calculation of columns
Closed

Comments

  • AAARob started the conversation

    Can you please send me some calculation examples and how to use them?

    For example, I want to calculate Column A + Column B = Column C?
    Or I want to calculate Column A * Column H = Column J?
    Another example: column K + (column A : column G)?

    Similar to Excel is possible.

    I can't find anything about this in your documentation.
    Or do I have to write that into the database backend (MySQL) created by wpDataTables.

  •  1,688
    Miloš replied

    Hi, AAARob .

    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.

    -

    What you need for this use-case is our Formula (calculated) columns.

    This can allow you to add a new Formula Column, and you can go in the Formula settings.

    You will be able to use multiple columns for basic math operations,

    and each row will be calculated showing the result in that Formula Column.

    -

    Please note that only numeric (float and integer columns) can be used in formula columns.

    And the Supported operators : Formulas in wpDataTables support all arithmetic operators, brackets to define the calculation order, and trigonometric operators.

    -

    You can check out this example here, where we show a table that calculates Tax based on a column multiplied by a fixed number.

    4225323726.png
    1145192227.png

    You can also try out different Formulas on that table from the Example on our Sandbox.

    Click here to see this table in our sandbox site or here to play around with back-end configuration.

    -

    To be more specific about your examples :

    1. calculate Column A + Column B = Column C?

    Make a new Formula Column, it will be your Column C.

    Then in this Formula, just use Column A , add the plus symbol,   add Column C;

    and then each resulting row will show in your Formula Column C.


    2. Same goes for the multiplying between Column A * Column H,  make another Formula Column as Column J.


    3. For this you will need a Formula Column, too,

    then in the Formula use : column K + (column A : column G)

    -

    Let us know how it goes and if you have any questions.

    Kind Regards, 

    Miloš Jovanović
    [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

  • AAARob replied

    could it be that the new column with the formula is not stored in the mysql database? As a separate column.

    In any case, I can't find this column in my phpMyAdmin!

    I need the values from the column so that I can continue calculating with the results! In addition, I would be able to show my customers any interim results.

  •  1,688
    Miloš replied


    Hi, AAARob.

    You are correct. Unfortunately, at this time, we do not have a working solution for the use-case you described.

    At the moment, when you add a Formula Based Column - it will only be visible in that table,

    and it does not store this column in PhPMyAdmin/ or in other words, it does not make a new column in the source database table,

    so it is not possible to pull the Formula based Column.

    -

    You can use a Formula Column in Charts, though,

     that is currently the only way to somehow "present" the data other than in the wpDataTable that is used for generating the Formula.

    -

    Please check more details and all the limitations that we pointed out on this documentation for Formula Columns.

    2735764297.png

    If you wish to see a solution for your use-case in the future,

    Please feel free to search on our suggestions page

     to see if someone may be already suggested this feature. If you can't see it, feel free to add your suggestion there,  and as more people vote, the feature will move higher on the priority list.

    You can certainly follow our changeLog page if you'd like ( it is also available in the plugin dashboard), where we state any changes/new features/bug fixes during updates;

    and our newsletter, so you're informed about new features, bug fixes, freebies, etc.



    Kind Regards, 

    Miloš Jovanović
    [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