WordPress.org

Forums

TablePress
[resolved] Sum to "number_rows" with filters (10 posts)

  1. eiagnalt
    Member
    Posted 2 years ago #

    Hi,
    I hope this isn't answered in an other topic.

    I'm trying to sum a total after filtering, but get this error:
    "!ERROR! Cell E4 does not exist"

    my code is:

    $current_user = wp_get_current_user();

    tablepress_print_table( array(
    'id' => '1',
    'shortcodes_before_formulas' => true,
    'hide_columns' => '1',
    'filter' => $current_user->user_login
    ) );

    and in table one E1 I have : =SUM(E2:E[table-info id=1 field="number_rows" /])

    thanks
    EinarA

    http://wordpress.org/extend/plugins/tablepress/

  2. TobiasBg
    Member
    Plugin Author

    Posted 2 years ago #

    Hi,

    thanks for your question.

    The problem here might be the filtering.

    [table-info id=1 field="number_rows" /]

    will return the number of rows of the unfiltered table, so that after filtering the resulting table most likely has fewer rows than that number.
    Could that be possible?

    To further understand this, I'd like to see your tables, if possible.
    Could you maybe post a link, or send me the info on how to see the tables via email (the address is in the main plugin file "tablepress.php")?

    Regards,
    Tobias

  3. eiagnalt
    Member
    Posted 2 years ago #

    Hi,
    I printed "number_rows" and it's returning the original number of rows, not the filtered, so yes I think that might be the problem. And if I don't user any filters, the sum works perfect.

    Is it a way to count the filtered number of rows?

    thanks,
    Einar

  4. TobiasBg
    Member
    Plugin Author

    Posted 2 years ago #

    Hi,

    ok, thanks for testing this!

    Unfortunately, I can't really think of a possibility here :-(
    The best chance I see is to create a custom Extension that, based on the Filtering Extension, calculates the number of rows of the filtered table, and then returns that with a Shortcode...

    Regards,
    Tobias

  5. Schmalitz
    Member
    Posted 1 year ago #

    Hi Tobias,

    Thank you for the great tool and extensive support here in the forum!

    Any news regarding this filter-sum issue? Having exactly the same problem like eiagnalt.

    Would be awesome!

    Best ragards
    Schmalitz

  6. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    thanks for your post.

    No, sorry, no news here :-( I still have not found a nice way of making the number of filtered rows available here :-(

    Regards,
    Tobias

  7. Schmalitz
    Member
    Posted 1 year ago #

    Hi Tobias,

    Sorry for annyoing with this. I've seen the 1.2 version and was wondering if this function maybe has been added?

    Thank you very much!

    Best regards,
    Schmalitz

  8. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    no, sorry. I have not made progress on this in the last two weeks.
    Once I do find a solution, I would add it to the changelog of the plugin update, so that I can be seen easily.

    Regards,
    Tobias

  9. Schmalitz
    Member
    Posted 1 year ago #

    Hi Tobias,

    First, good luck with your PhD!

    Sorry for bothering but may I ask if my above topic has been solved in the meantime? I have seen the php extension which potentially could do the job. I'm not sure if this extension already excisted when I initially posted my query here. I also checked the changelog without final answers.

    Now - as my php skills are quite weak I just wanted to check if there now maybe is an easy way before getting started...

    Thank you very much in advance!

    Greetz from Hamburg
    Schmalitz

  10. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    thanks for the wishes!

    Unfortunately, I couldn't find a solution here, yet. Sorry. The idea that I had for implementing this won't work, as the formulas are evaluated before the filtering is performed.
    I'll try to investigate if I can make the [table-info] Shortcode do the filtering as well, but I can't promising anything here.

    Regards,
    Tobias

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • TablePress
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic