• Resolved rokpalcic

    (@rokpalcic)


    Hi there! Just started using the premium version of your plugin to manage my sql database and am looking forward to learning more about it over the coming months. While I was able to create and display full tables with ease, I was wondering whether it would be possible to fetch a single cell value (or sum of rows/columns) and include it in posts/pages.

    Concrete example: I run a small arts nonprofit and would like to display the sum of donations obtained from donors between the period of July and September 2023 as a chart (ideally using Divid theme’s bar chart module).

    I thank you in advance for your support!

    Thanks,

    Rok

Viewing 11 replies - 1 through 11 (of 11 total)
  • Hello, I’m not an expert, I think with hyperlink in data explorer you can send a query param to an other page (link like mysite.com/number?25 for exemple), and in Divi, you can add a dynamic content with this param in the widget.

    There is too a REST API module in data explorer, but I don’t find documentation about it.

    Thread Starter rokpalcic

    (@rokpalcic)

    Thanks for the quick reply and pointing me in the right direction! It does look very promising, but I fear I lack the required knowledge to get it to work. I will keep working on it and wait to see if someone else has a solution that would work for me right away.

    Plugin Contributor Kim L

    (@kimmyx)

    Hi @rokpalcic,

    Thanks for the post. WP Data Access has a chart builder you can utilize for this. You can use a query to create the single-cell value for the sum.

    Let us know if that works for you and if you have more questions. ?

    Thread Starter rokpalcic

    (@rokpalcic)

    Thanks! I have toyed around with it and managed at the very least to get the query right to display what I need (donations made during a certain period).

    However, when I want to display it as a chart, I get the following message: “Not enough columns given to draw the requested chart.” I suspect this is due to the fact that I need at least one more column to compare this value to. What would be the correct syntax for it? Currently, I have

    SELECT SUM(zc5_Amount)
    FROM Donations
    WHERE
    zc5_Date BETWEEN ‘2022-07-01’ AND ‘2023-06-30’

    Really appreciate the help and responsiveness!

    Here’s a MySQL query that will sum “row2” and order it by “row1″…

    Works!

    SELECT row1, SUM(row2) “Total from table GROUP BY row1 ORDER BY row1 ASC

    BUT MY QUESTION IS HOW DO YOU INSERT THIS IN A TEMPLATE AT THE FOOT OF THE LIST?

    • This reply was modified 1 year, 5 months ago by jammerpro.
    • This reply was modified 1 year, 5 months ago by jammerpro.
    • This reply was modified 1 year, 5 months ago by jammerpro.
    • This reply was modified 1 year, 5 months ago by jammerpro.
    Plugin Contributor Kim L

    (@kimmyx)

    Hi @rokpalcic ,

    Glad you were able to explore the chart builder! That’s correct, you need at least another column to be able to display the bar chart properly. For your use case, you need to show the date as well since this is your WHERE condition.

    Please try the query below:

    SELECT zc5_Date, SUM(zc5_Amount)
    FROM Donations
    WHERE
    zc5_Date BETWEEN '2022-07-01' AND '2023-06-30'

    Let us know how it goes! ?

    • This reply was modified 1 year, 5 months ago by Kim L.
    Plugin Contributor Kim L

    (@kimmyx)

    Hi @jammerpro,

    That’s possible with a custom JavaScript in Advanced Settings if you’re displaying your table using Data Tables. Could you create a new thread so that we can address your concern specifically?

    We appreciate your patience!

    Thread Starter rokpalcic

    (@rokpalcic)

    Thanks! It’s definitely a step in the right direction. I understand now that individual columns are separated by commas. Is there documentation explaining all parameters and display customization options? For instance, how would I compare two different sets of dates from the same column (e.g. donations from 2022 vs 2023)?

    Thanks,

    Rok

    Plugin Contributor Kim L

    (@kimmyx)

    Hi @rokpalcic,

    You’re welcome! Data sets for the chart are created with SQL queries. You can find a guide/hint of the query format for each type of chart when you hover over each type. See here: https://share.zight.com/xQuNgnYY

    how would I compare two different sets of dates from the same column (e.g. donations from 2022 vs 2023)?

    You can use the CASE WHEN statement to compare the two dates’ sum and assign an alias for each. You can find examples below:
    SQL CASE Statement (With Examples) (programiz.com)
    SQL CASE Expression (w3schools.com)

    Hope that helps! Let us know if you have more questions. ?

    Thread Starter rokpalcic

    (@rokpalcic)

    Thanks a million for the speedy response! I will look into this a bit more, but thank you for helping me get started!

    Plugin Contributor Kim L

    (@kimmyx)

    You’re welcome!

    Feel free to create a new thread if you have new questions. ??

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Display column sum in post (newbie alert)’ is closed to new replies.