Type:Boolean Custom label formatter

From semantic-mediawiki.org
< Help:Datatype "Boolean"
Help:Datatype "Boolean"Type:Boolean Custom label formatter

Consider, e.g., a Boolean property successful in a wiki about projects, that describes whether or not a certain project was a success. Displaying all projects with their success status could then be achieved as follows:

{{#ask:
 [[Category:Project]]
 |?successful#success,failure
}}

where success and failure are displayed in a result column labeled "successful". Note that this column may have empty fields, for projects where the success or failure was not determined yet. This is a difference to categories, which can either be true or unset, but not explicitly set to false. So if we would have used a category Category:Successful project then we could have created only the following query:

{{#ask:
 [[Category:Project]]
 |?Category:Successful project#success,failure
}}

In this case, an extra column labeled "Successful" appears again, but now showing success for all results that belong to the category Successful, and showing failure for all other cases (including those where the status may be unknown).

In both of the above cases, it is possible to use "=" to change the label of the result column, as usual, e.g.:

{{#ask:
 [[Category:Project]]
 |?successful#success,failure=Success status
}}

Finally, the labels given for true and false (or category membership and non-membership) can also be special symbols or images, and may also be empty to show nothing. However, at least the comma should always be set. So to display a tick (actually a square root symbol) for true one could use:

{{#ask:
 [[Category:Project]]
 |?successful#√,
}}