Help:Plainlist format – variable #rowcount

From semantic-mediawiki.org
Variable #rowcount
This help page explains how to add a rowcount to a template.
Keywords

This help page explains the usage of the #rowcount variable when using templates with 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). to display the output of your queries. It was introduced with Semantic MediaWiki 3.0.0Released on 11 October 2018 and compatible with MW 1.27.0 - 1.31.x..1

This variable is passed to the templates defined with the parameters template, introtemplate and outrotemplate.

Example[edit]

Syntax
{{#ask:
 [[Category:City]]
 [[Located in::Germany]]
 |?Population
 |?Area
 |format=plainlist
 |introtemplate=TableUnnamedArgsRowcountHeader
 |template=TableUnnamedArgsBody
 |outrotemplate=TableFooter
}}
Result

This table provides an overview of the 6 cities recorded:

City Population Area
Berlin 3,520,061 891.85 km²344.34 sqmi <br />
Cologne 1,080,394 405.02 km²156.38 sqmi <br />
Frankfurt 679,664 248.31 km²95.87 sqmi <br />
Munich 1,353,186 310.43 km²119.86 sqmi <br />
Stuttgart 606,588 207.35 km²80.06 sqmi <br />
Würzburg 126,635 87.63 km²33.83 sqmi <br />

The templates used to create this example: TableUnnamedArgsRowcountHeader, TableUnnamedArgsBody and TableFooter. The variable was added to template "TableUnnamedArgsRowcountHeader" specified with parameter introtemplate.

Note
  • The variable is added to the template like, e.g. {{{#rowcount}}}.
  • Usually this variable is added to the template specified with parameter introtemplate or parameter outrotemplate.
  • This variable counts all results matching the query condition not just the ones displayed, i.e. limiting the results with parameter limit or offset does not change the count displayed.

See also[edit]

References

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