• Resolved Michael

    (@taloscent)


    Maybe a long shot here but…
    I can use a shortcode in the cell but I can’t use the shortcode in a formula in the cell. Basically what I was hoping to do is reference a value like $2.00 in one place and use it in a formula in multiple tables. That way I can edit the referenced value of $2.00 and it would update across multiple tables.
    Possible? Thanks

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

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

    (@tobiasbg)

    Hi,

    thanks for your question and sorry for the trouble!

    Yes, due to implementation aspects, Shortcodes are evaluated after formulas, which is why this does not work. However, there’s a TablePress Extension at https://tablepress.org/extensions/shortcodes-before-formulas/ that can used to switch this order. Just install and activate that as a regular WordPress plugin and extend your table’s Shortcode to

    [table id=123 shortcodes_before_formulas=true /]

    Another and easier approach would be to use a cell reference to a hidden cell.
    For example, you could add a new first row to the table and hide it via the corresponding button on the “Edit” screen of the table.
    Then, cell A1 could contain that referenced value, and you could use “A1” anywhere in the formulas to reference it.

    Regards,
    Tobias

    Thread Starter Michael

    (@taloscent)

    Understood. Using the extension I get the formula to work.

    Is there a way to add some formatting to the cell for example if I wanted a $ in front of the resulting number?

    Using your more simple suggestion, can a cell reference a cell in another table? The goal here being to be able to edit a value either in a shortcode or in a cell that is then referenced across multiple tables on multiple pages.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    good to hear that the Extension helps! ??

    No, formatting the results of a formula evaluation is not possible at the moment, sorry. ?? That would require some custom coding, e.g. by hooking into one of the plugin filter hooks and manually adding the $ sign for the relevant cells.

    Referencing a cell from another table is not directly possible with “plain” formulas, but you can use a Shortcode as well. Please see the thread at https://www.ads-software.com/support/topic/calling-other-table-cell-values-from-another-table for more information on that (that’s actually the thread where the above mentioned Extension comes from).

    Regards,
    Tobias

    Thread Starter Michael

    (@taloscent)

    Thank you for that reference. I will explore that option. Thanks for taking time out of your life to continue to support this.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    no problem, you are very welcome! ?? Hope that links helps!
    If you still have problems, just let me know!

    Best wishes,
    Tobias

    P.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘shortcode used in cell’ is closed to new replies.