Okay
  Public Ticket #2075460
Chart last entry only
Closed

Comments

  • Jonathan started the conversation

    I have created a retirement calculator that shows the growth of their retirement fund.  I have managed to get over most issues but two remain:

    1) When showing the chart - I only want to pick the last data entered.  There may be 10 entries in a day so the date filter isn't going to work. Is there a way?

    2) is there a way to batch change the table field type?  I have 250 fields that when they come across to the chart are a mix of integer and string.  I want to batch change them all to integer. Just takes too long to manually change each one!


    Thanks

  •  2,496
    Aleksandar replied

    Hello Jonathan

    I am sorry to disappoint you, but unfortunately something like this is not possible with the plugin's built in features.

    You may want to add a timestamp column, and sort the table by that column on page load, and display only 1 row per page. That way you would filter it in descending fashion, and if you enabled "Follow table filtering" when you created the chart - it will only display the results for that one row currently displayed in the table.

    Creating a timestamp column is not implemented in the plugin's built in features. However, there is a workaround for this.

    For example, I created a simple manual table:

    9084543304.png

    wdt_ID column is being automatically generated, and is usually hidden, but I've displayed it here for explanation purposes.

    When I created a table, and added the first row, I could then modify it. So, in order to set the Datetime column to be auto-populated, I had to open the table in the database. It is being stored as wp_wpdatatable_6, and you can see its database name in Editing tab in the settings above the table:

    8975736742.png

    Then, in PHPMyAdmin, I opened the table, and ran the following query:

    ALTER TABLE `wp_wpdatatable_6` CHANGE COLUMN `datetime` `datetime` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP;
    
    7657773118.png

    After that, again in the Editing tab, above the table, I changed the "ID column for editing" from "wdt_ID" to "datetime" (as you can see in the screenshot above). Then I disabled editing for "wdt_ID" in the column settings:

    4393899573.png

    datetime column, being the "ID column for editing" automatically cannot be edited, but is automatically filled.

    You can also choose to hide it from view if you'd like.

    I hope this helps.

    As for changing the field type - you can only change the column type like this. Please note, though, that if you change the column type to integer you will not be able to add anything else other than numbers.

    Best regards.

    Kind Regards, 

    Aleksandar Vuković
    [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

  • Jonathan replied

    Ok, for those who were monitoring this string, this is where I am up to:

    The issues were getting Gravity Forms to only show the last entry so that the notification showed the correct summary and growth chart.  While I was determined to not do any custom PHP work to make it happen I found that I had to do a quick extra coding to get Gravity Forms to use the latest entry for the charts and summary and then delete the entry so next time there was only one.

    The code was added to the theme functions.php file and I found it in the GF docs: https://docs.gravityforms.com/delete-entry-data-after-submission/

    I did try a few plugins but they had some unexpected results.

    Note: I am using wpdatatables to create the charts as it was the only one I could find that would do it properly.  However, before you drop in the above code and delete all old entries, get your chart right first.  As soon as you delete everything and go and try to configure the charts or tables it throws up fatal errors as there are no entries to build from.  So if you try out my form, you will still see that two charts show up at the end (I am keeping one old entry in there in case I need to make chart or table changes) until I hand it over and delete the old entry.

    Gravity pdf looks to be working too - just need to sort out the look of the document.

  •  2,496
    Aleksandar replied

    Hello again Jonathan.

    Thank you for sharing this information with us. It will be of use both to us, and other customers that have similar issues.

    If you have any issues with the plugin, please feel free to open a new ticket, and we'll gladly help.

    Best regards.

    Kind Regards, 

    Aleksandar Vuković
    [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