• Resolved marketing guy

    (@el-terrible-bmw)


    I have 2 columns in my table that are for year and price and I want to have 2 additional columns, one that calculates inflation and another that calculates change from one row to the next. I would just like to know what’s the best way of doing that?

    If I wanted to do that right now, I would do it during output, but I’m afraid that’s probably not the most efficient way since it would re-calculate on every page load and could be a resource-hog if there was a lot of traffic.

    Is there a way to maybe do it when the table is saved from admin section and then I can have it calculate and populate those fields at that point so that when the table is loaded from the front end, it just loads it as a regular table?

    https://www.ads-software.com/plugins/tablepress/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    The question here is what kind of equations you need. If you can do this with the TablePress formulas (see https://tablepress.org/tablepress-features-formulas/ ), I suggest to use that.

    Another idea would be to do this in Excel and export/import a CSV file with the calculations already performed.

    And no worries about re-calculations. TablePress has an internal output cache that will prevent re-calculations on every page load.

    Regards,
    Tobias

    Thread Starter marketing guy

    (@el-terrible-bmw)

    Nah the TablePress formulas won’t really work, at least not for a part of it.

    What I might do is just create a small JS script that does this on the table edit page and then I can just save the table after running the JS script.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    yes, if you want to do this with JS, then that’s probably the best approach.

    Best wishes,
    Tobias

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Best way to have calculated columns’ is closed to new replies.