Help:Count the number of property values for a page

Semantic extension(s): Semantic MediaWiki
Further extension(s):  -/-
Keyword(s): property · ask


There is no easy way to retrieve the count of a property's values. This is a snippet you can use to count them down:

    [[My Page Name]]
    [[My Property Name::+]]
  }} > 0
         [[My Page Name]]
         [[My Property Name::+]]
         |?My Property Name=
       |,}} + 1
  • The #ifexpr part checks whether the property is even set; else returns 0.
  • if the above does not result in 0, the #expr part retrieves the property contents as a comma-separated list (you may change the comma separation to something else if necessary) and counts the occurrences of the commas. The result is increased by 1, resulting in the values' count.
  • You're using two #ask statements here. This may behave slowly if the property contains large amounts of values.