Talk:Norway/Media
Where can I find a template for creating a table? I want to make one over all nationality=Norwegian nationality=Norway and constitutes=editor and constitutes=journalist constitutes=Media owner Terje (talk)
- THe first place I thought of is Template:SMWDocs, since this includes a whole bunch of tables. There is for example Template:Nationals. However, these are all using Template:SMWDocSection, so perhaps that is a better place to start. From the code:
{{ask
|format=table
|limit={{{limit|}}}
|sort={{{sort|}}}
|order={{{order|}}}
|expression={{{expression|}}}
|mainlabel={{{mainlabel|}}}
|properties={{{properties|}}}
|headers={{{headers|}}}}}
}}
This is using Template:ask, which I worked hard on to make flexible enough for most purposes. It has a not very widely used yet syntax of '/' as separators for the properties and headers fields. The plain vanilla table looks like this:
Norwegian Editors |
---|
Kjetil Alstadheim |
Trine Eilertsen |
Torolf Elster |
Thor Gjermund Eriksen |
Einar Førde |
Rolf Gerhardsen |
Per Egil Hegge |
Helge Seip |
Hanne Skartveit |
Nils Udgaard |
Hans Vatne |
Dagfinn Vårvik |
The source code for that table looks like this: {{ask
{{ask
|format=table
|limit=
|sort=
|order=
|expression=[[Constitutes::Editor]][[Has nationality::Norway]]
|mainlabel=Norwegian Editors
|properties=
|headers=
}}
Note that SMW understands all words as equivalent if they redirect to the same page, so [[Has nationality::Norway OR Has nationality::Norwegian]]
is unneeded. So the first start at the table you're looking for is:
This has source: {{ask
{{ask
|format=table
|limit=
|sort=
|order=
|expression=[[Constitutes::Editor]][[Has nationality::Norway]] OR [[Constitutes::Editor]][[Has nationality::Media mogul]] OR [[Constitutes::Journalist]][[Has nationality::Norway]] OR [[Constitutes::Publisher]][[Has nationality::Norway]]
|mainlabel=Norwegian media players
|properties=
|headers=
}}
The next step is to decide what which columns the table should have, which is expressed as |headers and |properties. These use the '/'-separated list syntax used for |key_properties
and |key_property_headers
, for example at the "Lone nut" page.
Hmmmm, that table does not appear to have a 'description' column on the preview. I wonder whether it will if I save it? No. I'll sleep on it. Building such tables has long been the intention of the SMW set up as is, and if it's done properly it shouldn't take much effort, given how hard we've worked to put the data in the database. The wisdom of years asks "which templates would be good to have to build these tables?" [[Template:Media players]?
P.S. I just remembered another page I added tables to: Banker/Premature deaths . That could be another place to start. -- Robin (talk) 19:29, 4 July 2023 (UTC)