We're Moving to a New Support Platform – Starting June 1st!

We’re excited to let you know that starting June 1st, we’ll be transitioning to a new support system that will be available directly on our product websites – AmeliawpDataTables, and Report Builder. In fact, the new support platform is already live for Amelia and wpDataTables, and we encourage you to reach out to us there.

You'll always be able to reach us through a widget in the bottom right corner of each website, where you can ask questions, report issues, or simply get assistance.

While we still do not offer live support, a new advanced, AI-powered assistant, trained on our documentation, use cases, and real conversations with our team, is there to help with basic to intermediate questions in no time.

We're doing our best to make this transition smooth and hassle-free. After June 1st, this current support website will redirect you to the new "Contact Us" pages on our product sites.

Thanks for your continued support and trust – we’re excited to bring you an even better support experience!

Okay
  Public Ticket #1604551
Dynamic queries
Closed

Comments

  • Ariel started the conversation

    hi,


    Before I purchase I wanted to make sure I can build charts based on dynamic queries, composed of drop down selections from the user.


    Thanks!

  • [deleted] replied

    Hi Ariel,
    Thank you for the inquiry.

    Can you please describe me your inquiry in more details? Do you want to build dynamic charts or tables? When user select something from the dropdown filter, you want to filter table/chart also?

    You can try our sandbox site: Front-end & Back-end - you can find a fully functional version there to try out all plugin features.

  • Ariel replied

    Hi Milos,


    yes, i need exactly what you described -  


    "i want to build dynamic charts so when user selects something from the dropdown filter it will filter table/chart ,


    possible?

  • [deleted] replied

    Hi Ariel,

    Something like that is possible. You have to have both wpDataTable and wpDataChart on the page. While you are creating chart you have to enable "Follow table filtering" feature to achieve this. You can take a look at it on this page from our documentation - Follow table filtering in charts.

    For example on this page you can try to filter "Type" column by selecting some value in the drop-down and you will see that chart will update it's data based on selected value.

    You can try our sandbox site: Front-end & Back-end - you can find a fully functional version there to try out all plugin features.

  • Ariel replied

    Hi and thanks.

    it's not enough, i cant show the table to my customers, only the final chart.

    Moreover, i have to give them independent dropdowns (i mean not as part of any table)  from which each selection will create a dynamic query, which in turn will fire the chart to change according to the new data.

    is it possible in your plugin?

  • [deleted] replied

    Hi Ariel,

    It is possible but with small custom CSS code that we can send to you. Yes, filters can be independent from the table. You can take a look at this page how filters are in the form above the table. https://wpdatatables.com/documentation/table-features/advanced-filtering/#advanced-filter

    You can hide the table with CSS so it will not be visible (just filters will be visible), and then when you change the values in the filters, the chart will be updated.

  • Ariel replied

    I and thanks again:-)


    i need the flexibility of just sending my sql query to the chart and the chart will change.


    is it possible?

    (im a developer so even if it means a small "touch" in PHP it's ok)

  • [deleted] replied

    Hi Ariel,

    When you are filtering the wpDataTable that is created from MySQL query it will automatically add WHERE clause on the query. For example if you create wpDataTable from:

    SELECT * FROM table_name

    when you filter the wpDataTable column called e.g. "a", our plugin will automatically add WHERE and query that will be sent to database will be:

    SELECT * FROM table_name WHERE a LIKE '%some value%'

    It is possible to intercept the query using hooks. The hook you need to use is wpdatatables_filter_mysql_query($query, $tableId)

    "This filter is applied to the MySQL query before it is sent to MySQL server.

    $query is the query text

    $tableId is the table identifier from the MySQL table (wp_wpdatatables)."

    You can take a look at all available hooks on this documentation page.

  • Ariel replied

    Thanks again, still i want to ne precise:

    if i intercept the query can i build query with a join of two tables + group by?

    lets say i want to display in the chart expenses of salaries of employees in the company per year:

    select salaries.year, sum(12*salaries.month_salary)  as  TotalEmployeesExpenses

    from employees inner join salaries 

    on employees.id = salaries.id

    group by salaries.year

    thanks!

  • [deleted] replied

    Hi Ariel,

    You can build query with a join of two tables but you will have to have the same number of the columns (and the name of the columns) like in the table that you created. Can you explain me why would you need this? Why can't you use joins directly when you create wpDataTable?