How to create a Dynamic Table

Creating a Dynamic Table

Point the wizard at data that keeps changing, and let the post show today's figures without anyone editing it again.

What a dynamic table really is

A dynamic table is a data source. The wizard creates one, saves it under Tabulizer › Data Sources, and puts a short tag into the block pointing at it. Nothing of the table itself is stored in the post.

The payoff is that the table is read fresh when a visitor opens the page. Replace the spreadsheet on the server, or let the database fill up with new rows, and every post carrying that tag shows the new figures. Nobody edits a post; nobody remembers which three pages had last quarter's numbers in them.

The trade is editability. A data source tag is not content you can type into - you cannot fix a spelling in the post, because the cells are not there. They are produced when the page is rendered. If you want to adjust the result by hand, you want a static table (Tutorial 1).

Getting there

Add a Tabulizer Table block where the table belongs, click Open Tabulizer Wizard, and choose New Dynamic Table on step 1.

Step 2 - name it, and choose the source

This step asks for one thing the static modes never do: a Data source title.

Step 2 of the Tabulizer wizard in New Dynamic Table mode, headed Step 2 Choose Data Source, with a Data Source Title field containing Quarterly figures by region and a Source Type drop-down set to Database query.

The title is how the data source will be listed under Tabulizer › Data Sources afterwards, and it is worth five seconds of thought. A site accumulates data sources quickly, and they are listed by title - “Quarterly figures by region” is findable in a year's time, “Table 4” is not.

The source list is the same one a static table gets, with exactly two changes - and both make sense once you see them.

Change Why
Typed / pasted text disappears Text you typed into a wizard cannot change by itself. There would be nothing for a dynamic table to re-read, so the option is simply not offered.
Form Entries appears Submissions to a Tabulizer form arrive over time, which is the definition of changing data. It is only useful dynamically, so it only shows up here.

Everything else - CSV / Text file or URL, Excel / ODS file, Database query, HTML table from URL, Google document / sheet, JSON URL, Google / ICS calendar, RSS feed, XML URL - is available in both modes. Here, though, they behave the way you would hope: the file or the endpoint is read again on each page view rather than once.

Step 3 - configure the source

The fields depend on the source. A database query asks which connection to use and what to run.

Step 3 of the Tabulizer wizard in New Dynamic Table mode, showing a Connection choice of WordPress database or External database, a SQL Query box with a SELECT statement, an Add header row checkbox, an Empty Results Message field, and an information notice explaining that the wizard keeps data source creation simple and to use the Data Sources page for more options.

Field Notes
Connection WordPress database uses the site's own connection - no credentials to enter. External database opens host, database, user and password fields for a separate server.
SQL query A SELECT. Write it against the real table names, remembering that WordPress tables carry the site's prefix.
Add header row Whether the column names become the table's first row. Leave it off and the table starts straight at the data - which is right for some tables and startling in others.
Empty results message What a visitor sees when the query returns nothing. Worth filling in - the default is a bare empty table, which looks broken rather than empty.
The query runs on every page view, under the permissions of the site's database user. Select only the columns you intend to publish - a SELECT * against the users table will put email addresses on a public page.

The notice at the bottom of step 3

The wizard says this about itself, and it is the most useful sentence in it:

“This wizard keeps data-source creation intentionally simple. If you need more configuration options such as table caption, cache, server-side loading or other advanced parameters, create the data source from the Data Sources page.”

That is an accurate description of the trade. The wizard asks for what it needs to get a table on screen. The full data source form, reached from Tabulizer › Data Sources › New, offers considerably more:

Available on the data source What it gives you
Caching A cache type and lifetime. The single most useful setting for a remote file or a heavy query - without it, every page view goes and fetches the data again.
Table caption and summary Accessible description text attached to the table itself.
Server-side loading For large tables, paging and searching handled on the server instead of in the browser.
Header row contents Supply your own column headings instead of taking whatever the source calls them.
Column mapping and table order Reorder, drop or remap columns without changing the query or the file.
User parameter labels Name the values that can be passed in at render time, so they are self-describing.
If you know in advance that you need any of these, build the data source on that page first and then insert it with the Existing Dynamic Table mode - Tutorial 4. The wizard is the quick path, not the complete one.

Steps 4 and 5

Step 4 is the familiar Ruleset archive and Ruleset pair. The difference from a static table is where the choice is kept: it is stored on the data source, not in the post. Change it later on the data source and every post using that tag follows, with nothing to re-edit.

Step 5 summarises and offers Insert.

What lands in the post

Two Tabulizer Table blocks in the WordPress editor: the upper one showing the rows of a generated static table as editable text, and the lower one showing only a single tabulizer data source tag beneath its Open Tabulizer Wizard button.

One line: {tabulizer:data_source[…]}. No table, no stylesheet marker, no rows - the tag is the whole thing. The picture above shows the contrast plainly: a static table block full of editable rows, and below it a dynamic one holding a single tag.

Preview the post to see the table. In the editor you will only ever see the tag, which is exactly what you should see: there is nothing stored there to render.

The published page showing three Tabulizer tables stacked: an orange static table with Region, Q1, Q2 and Q3 columns, and below it two blue-green dynamic tables each listing the three query result rows.

On the page itself there is no way to tell which table was static and which was dynamic - and that is the point. The difference is entirely in how they got there and what happens when the data changes.

The data source you just made

Go to Tabulizer › Data Sources and it is there, under the title you gave it, with its tag, its source type, its archive and ruleset, and its query. Click it to edit any of that - including the settings the wizard never offered.

Common questions

Can I edit the table in the post?

No, and that is the deal. The block holds a tag; the cells do not exist until the page is rendered. Edit the data, or edit the data source.

I deleted the block by accident.

The data source is untouched - it lives under Tabulizer › Data Sources. Insert it again with Existing Dynamic Table.

Can the same data source appear in two posts?

Yes. Insert the same tag in as many posts as you like; each renders it independently, and the cache serves them all.

The table is slow.

Turn on the data source's cache from the Data Sources page. A remote file or a large query re-read on every page view is the usual cause.

The page shows an empty table.

The source returned no rows. Set an Empty results message so visitors see a sentence rather than an empty frame, then check the query or the file path.

My table has no column headings.

Add header row was left unticked on step 3. Edit the data source and turn it on.

Make one from live data

Add a Tabulizer Table block and choose New Dynamic Table.

Back to the Knowledge Base