Welcome to the Virtual Education Wiki ~ Open Education Wiki

Help:Show

From Virtual Education Wiki
Revision as of 14:32, 17 May 2023 by Pbacsich (talk | contribs) (new entry)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Parser function #show

This material is extracted from https://www.semantic-mediawiki.org/wiki/Help:Inline_queries


A common usage of queries is to display only a single property value for a single page. For example, one could insert the population of Berlin into some page, and use a query instead of manual copying to achieve this. SMW provides a special shortcut parser function to make such queries simpler: #show. For example, one can write the following to display the population of Berlin on a page:

Syntax
{{#show: Demo:Berlin |?Population }}
Result


The parser function otherwise works like an inline query, and all parameters available for inline queries can also be used on #show if desired. However note that the #show parser function only takes one argument (a page) as the query condition, i.e. the name of the page that should be queried.

The above query written with the #ask parser function looks as follows:

Syntax
{{#ask: [[Demo:Berlin]] |?Population= |mainlabel=- }}
Result


Here the "=" added to the queried property "?Population" removes the display of the property label and parameter "mainlabel=" followed by the "-" symbol removes the first result column and the label of the column.

Without this, the result would display a table with two columns and rows:

Syntax
{{#ask: [[Berlin]] |?Population }}
Result
 Population
Berlin

> Help:Index