• Resolved jrvcosta

    (@jrvcosta)


    Hi Tobias!

    I have a table containing only numeric values and I’m looking for a way to display the value of a cell in a conditional way. For example:

    IF (value of cell 1)=’x’ AND (value of cell 2)= “y ” DISPLAY (value of cell 3)

    Is there a way to do this?

    Thanks, and have a great year!

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

    (@tobiasbg)

    Hi!

    Thanks for your post and sorry for the trouble!

    Yes, this should be doable with the Excel-like math formulas that TablePress supports. So, essentially, you could to use a construct with the Excel IF function here.

    Best wishes,
    Tobias

    Thread Starter jrvcosta

    (@jrvcosta)

    Thank you for the answer… but just for clarify me better, aren’t these mathematical functions and formulas handled within table cells?

    I’m trying an external command, like a shortcode, that accesses a given table, checks the values, and returns (conditionally) the field from a cell directly on a post of my website.

    Thank you again!

    Plugin Author TobiasBg

    (@tobiasbg)

    HI,

    thanks for the clarification! Indeed, I was under the impression that you want to do this inside the table.

    Now, there might however still be a solution, also based on formulas: For TablePress premium license holders, there is a TablePress Extension available that can show table cells (with evaluated formulas) outside of a table, as normal text content, using a Shortcode. With this, you could show such an evaluated Excel-formula outside of a table.

    Best wishes,
    Tobias

    Thread Starter jrvcosta

    (@jrvcosta)

    Hi Tobias!

    Your plugin is great and I really wouldn’t hesitate to purchase a premium license if I had the budget. But my website is non-profit and I can’t afford to do that.

    I apologise for pressing the point, but isn’t there a way to “read” the contents of a Tablepress table with PHP code? If I could do this I could use PHP’s own syntax to do the conditional.

    Take care and have a nice day!

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    I totally understand that the premium versions might not be possible for all sites, especially when the budget is tight!

    As for the PHP code: You could use the load_table() method from the TablePress_Table_Model class (/models/model-table.php).

    Best wishes,
    Tobias

    Thread Starter jrvcosta

    (@jrvcosta)

    Thank you very much for the help, Tobias.

    I’ll find of a solution and post the code here to share.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    sure, no problem!

    Best wishes,
    Tobias

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to display the value of one cell based on the value of another’ is closed to new replies.