Jump to content
TNG Community
fluffy82

adding column

Recommended Posts

fluffy82

Hi all,

I could of course google the answer to this, but maybe some of you have already tried it or maybe can tell me why I should or shouldn't do this.

On my WP website, I have my own page with statistics. As I use WordPress widgets to show them, it's not possible to include javascript to create the diagrams. So I manually created diagrams and added the SQL queries manually. The consequence is that the page starts to load quite slowly, and the handmade diagrams aren't as pretty as I would want them to be.

Some WordPress plugins can make diagrams for you, but they only work with existing fields in the database, not through SQL queries.

My question: is it possible to add a table I would use for my statistics which is dynamic? Meaning that the cells are populated through a SQL query referring to other (TNG) tables, and are updated when I make a change to my TNG database? This way, I can create a diagram based on the cells of that new table, rather than on yet another SQL query.

Thanks for any advice on this!
Tom

Share this post


Link to post
Share on other sites
bhemph

Tom,

Yes, you could do this.  Create a new table within the database that has the columns that you want, maybe named something like tng_statistics_diagrams or even in Dutch so that you know the table name will not be one Darrin would ever choose.  Then create a php script that will execute the SQL queries that you need to populate/repopulate that table.  I would add that as a button to the secondary processes tab under the Import/Export since that is where other database update items are located.  Burial Website Media Import is a mod that you could use as a reference for how to put the script there.  You could create a whole new admin section like is done in Living Flag Backup / Restore or Private Flag Backup / Restore if that was your preference.  Either way it would be a manual process, but even if you import your data from a GEDCOM I would think that you would want that to be sure to complete before running this script instead of having it chained to the import process.  That way you could repopulate the diagram table independently any time you wanted, or if a problem occurred.  If you manually enter your data into TNG, having the manual trigger to build the diagram table allows you to do several updates before having the diagram table rebuild instead of having it trigger after each change and having to wait for the rebuild to complete before making the next person or family update.

Brent 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×