Help:Table format 0.4 - 1.6.1

From semantic-mediawiki.org
Jump to: navigation, search


This documentation page applies to all SMW versions from 0.4 to 1.6.1.
Other versions: ≥ 1.6.2       Other languages: de

Help:Table format en 0.4 1.6.1


Table format 0.4 - 1.6.1
Outputs the result in a table.
Available languages
deenzh-hans
Further Information
Provided by: Semantic MediaWiki
Added: 0.4
Removed: still supported
Requirements: none
Format name: table
Enabled by default: 
Indicates whether the result format is enabled by default upon installation of the respective extension.
yes
Authors: Markus Krötzsch
Categories: misc
Group:
Table of Contents

↓ INFO ↓

The result format table is used to format query results as tables. The format table is the default way of formatting query results for all queries that have one or more additional printout statements. It is very similar to the broadtable format.

Parameters

Parameter Type Default Description
class text sortable wikitable smwtable An additional CSS class to set for the table
transpose yes/no no Display table headers vertically and results horizontally
sep text empty The separator for values

There are no inline query parameters specific to the table format. The parameter headers=hide is specifically useful for hiding the header of tables (in most other cases, it is enough to use empty printout labels to hide the titles of printout statements).

Example

{{#ask: [[Category:City]] [[located in::Germany]] 
| ?population
| ?area#km² = Size in km²
}}

This produces the following output:

 PopulationSize in km²
Berlin3,520,061891.85 km²
344.343 sqmi
Cologne
Frankfurt679,664248.31 km²
95.872 sqmi
Munich1,353,186310.43 km²
119.857 sqmi
Stuttgart606,588207.36 km²
80.062 sqmi
Würzburg

Remarks

Tables have a special feature for sorting their contents by any of the columns in the table. See Help:Selecting pages for general comments on sorting and a comparison to the wiki's query result sorting. Browsers without JavaScript enabled will not see the buttons for sorting at all.

SMW formats its tables with CSS class="smwtable". Using this class on other tables to achieve similar formatting is possible, but will only work reliably if the according page contains a query or other SMW specific elements. In other cases, the SMW style files will not be loaded at all, so the style is not available.