Templates used to create a tabular output combined with math formats

From semantic-mediawiki.org
< Demo:Examples‎ | Queries(Redirected from Templates used to create a tabular output combined with math formats)
ExamplesExamples/QueriesTemplates used to create a tabular output combined with math formats
Templates for joining output
This page shows an example for the template format used to create a tabular output combined with math formats.
Format
Keywords
Table of Contents
These examples require Semantic MediaWiki 1.9.2Released on 18 April 2014 and compatible with MW 1.19.0 - 1.22.x. or newer due to an enhancement to the userparam parameter.1 Also note the changes that were made in Semantic MediaWiki 3.0.0Released on 11 October 2018 and compatible with MW 1.27.0 - 1.31.x., i.e. the names of the variables and the name of the result format changed.2 See the help page result format "Plainlist"Outputs results in a comma separated list, with additional outputs shown in parentheses. The output does not provide class attributes to HTML elements (default for queries without printout statements). for further information.

Examples[edit]

Without extra conditionals[edit]

Syntax
{{#ask:
 [[Category:City]]
 [[Located in::Germany]] 
 |?Population
 |?Area
 |format=plainlist
 |template=Template/Math/Table
 |introtemplate=Template/Math/Table/Intro
 |outrotemplate=Template/Math/Table/Outro
 |link=none
}}
Result
City Population Area
Berlin 3,520,061 891.85 km²
Cologne 1,080,394 405.02 km²
Frankfurt 679,664 248.31 km²
Munich 1,353,186 310.43 km²
Stuttgart 606,588 207.35 km²
Würzburg 126,635 87.63 km²
Average 1,227,754.667 358.432 km²
Total 7,366,528 2,150.59 km²


With additional conditionals[edit]

Syntax
{{#ask:
 [[Category:City]]
 [[Located in::Germany]] 
 |?Population
 |?Area
 |format=plainlist
 |template=Template/Math/Table
 |introtemplate=Template/Math/Table/Intro
 |outrotemplate=Template/Math/Table/Outro
 |link=none
 |limit=3
 |searchlabel=
}}
Result
City Population Area
Berlin 3,520,061 891.85 km²
Cologne 1,080,394 405.02 km²
Frankfurt 679,664 248.31 km²
Average 1,760,039.667 515.06 km²
Total 5,280,119 1,545.18 km²


The templates used to create the examples:

References

  1. ^  Semantic MediaWiki: GitHub pull request gh:smw:217
  2. ^  Semantic MediaWiki: GitHub pull request gh:smw:3130