Okay
  Public Ticket #3067965
Pre-filter calculation shortcode
Closed

Comments

  • Adam started the conversation

    I want to use the column calculation shortcode to display the sun, but with the table data pre-filtered. Example: [wpdatatable_sum table_id=1234 col_id=54321 var1=apples]

    Is this or

    Something similar possible?

  •  1,689
    Miloš replied


    Hi, Adam 

    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.

    -

    To be fully honest with you, i have been looking into this, but am still not able to confirm with 100% certainty if something like this is possible.

    I will get help from senior colleagues, and i will do my best to be as quick as possible from this point forward.

    As soon as i confirm this, i will report back to you.

    Thank you for your patience.

    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

  • Adam replied

    Thank you. I’d also be open to better understanding how to accomplish this via manual query, but it seems that since I created the tables with a live Google Sheet, there isn’t a DB table to query. 

  •  1,689
    Miloš replied

    Hi, Adam 

    Sorry for all the waiting time.

    Basically, at this time, the only way how you can achieve this by using a shortcode, is if the table is on the same page with the SUM shortcode.

    So, lets' say, for this table i have some clients and amounts of purchases.

    6703177269.png

    If we don't use any VAR or any filtering, the SUM of column for Ammount will be 4613

    -

    But if i add this VAR1 to the column "Clients" filter;

     and place a table shortcode with placeholder together with the SUM shortcode of the column on same page, like :

    [wpdatatable id=7 var1=Holmes]

    [wpdatatable_sum table_id=7 col_id=26 ]

    Then the table will prefilter, and the calculation shortcode will follow it, if they are on same page.

    7265714576.png

    But if i just try to use the SUM shortcode from the non-filtered table version, and add the VAR, it will not work.

    This shortcoe - [wpdatatable_sum table_id=7 col_id=26 var1=Holmes]   will only give us the unfiltered value of SUM

    8344183325.png

    So, basically, the calculation shortcode is only used to pull the SUM value from the table in its current state ( if it is filtered or not),

    but we can not use the calculation function to filter the table itself if that makes sense?

    -

    2.

    And you are correct, when we use tables linked to a file source, or spreadsheet, we are not able to use SQL Queries.

    It is possible, but it requires a high level of knowledge to pull off a custom SQL Query like that.

    Making SQL queries for users is not included in support, but we can always advise and help with some examples.

    -

    If you're interested to learn more how you can use placeholders to make dynamic SQL Queries, please check out this documentation with examples and a video.

    I hope that helps.

    Let me know how that sounds.

    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