Template:Job table/doc

is one of four templates used to create tables which list the episodes that have had a particular credit. The other templates in this series — all of which are required for the final product — are:
 * , the template that creates the table headers
 * , the template that closes the template
 * , the template that formats the data in the main body of the template
 * , the template that actually gets put on pages

Default variables
By default, this template assumes that it is working on all pages within the broad category, category:television stories. It also assumes that you are attempting to tabulate information about the property that has the same name as the page name.

These assumptions can both be changed.

Simplest case
In most instances, you would just place on a page and be done with it. As long as the page name matches the name of the property name, you don't really need to do much else.

If I typed on the page 3D artist, it will automatically generate a  table which was formatted like the rest of our infoboxes and tables. On the list would be all the 3D artists who had been credited on any episode of any television show that this wiki covers.

You can see this most dramatically by choosing a more ubiquitous title like writer.

The list always appears in a collapsed state — a condition which cannot be changed by using this template. Also the list is organised in alphabetical order of the title of the story, but it respects. This means that s at the beginning of titles are not considered during alphabetisation.

When the doesn't match the property name
Maybe the name of the page you're working on is visual effects producer but the property is Property:VFX producer. In this case, you'll have to make a slight modification:. This ability to change the property name comes in handy when you want to drop on of these tables onto a completely different page, as was done above with the table of writers.

When there's a lot of output
For some of the more ubiquitous titles, like writer, you'll probably want to break the table down into smaller tables — logically, one for each show. Or maybe you're working on a series page where you want to show only the writers for that particular series. In these cases you'll want to narrow the category down. For instance, will show you all the directors of photography for series 5.

Limitations
, there are a lot of limitations. At present, you can only categorise one element. This means you can't sort by the story number or the series number — nor can you put, say, directors and cinematographers in the same table — all of which would clearly be desirable. You also can't affect the titles in the headers.

However, none of these problems is likely insoluble. And there's certainly a way to do all of that with SMW, manually. These functionalities have merely not been integrated into this template as of yet.

General comments
This template is powered by SMW, a powerful extension to the standard MediaWiki software which allows the creation of truly relational data. A large part of the reason this template works is because properties have been applied to. This means that all the work that has been done on filling out credits on story pages has not been a vanity project. Now we are armed with a vast and complicated database of information about the people who have worked on Doctor Who since 1996. Our database on 1963-era Doctor Who still needs to be built.

Specifics of the template
This template uses a standard #ask: query, but then pumps the results through three additional templates. The head of the tables is created by, while closes the table. The guts — that is, the nitty-gritty of format each row of text — is handled by.

It looks like this:

1. To put this into plain English:
 * 1) asks of a category, usually Television stories, what are the names of all the people who did job1?
 * 2) creates a column with the names of the people who did the job1 (or, if undefined, the job with the name of the page)
 * 3) limits the output to 500 people
 * 4) sets the format of the output to template, meaning that it will pump the output through a template
 * 5) defines the name of the template handling the bulk of the data, in this case
 * 6) defines which template is called before the first line of raw data. In other words, it calls the template that creates the template headers.  At a minimum, this template must have  {|  in it.
 * 7) defines what comes after the last line of raw data. In other words, it call the template that closes the template.  At a minimum, this template must have  |}  in it.