Help talk:Count format
- [View source↑]
- [History↑]
Contents
Thread title | Replies | Last modified |
---|---|---|
Using format=count together with intro/outro | 1 | 16:07, 11 January 2019 |
Bad number of pages count in a category | 5 | 18:48, 4 December 2018 |
Just picked up the example from bugzilla using the intro and outro parameter.
{{#ask: [[Property::Value]]
|format = count
|intro = Found: 
|outro =  results:
}}
  is used as space character
null parameter[edit]
What do you think about adding some kind of null parameter to count? The ide is that if nothing is found (count=0) the text in the null parameter will be used. It can be helpful in the following scenarios: 1. We want to make count pretty and add some special text in case nothing is found.
{{#ask:[[Category:Scientist]] |format=count |null= No one |outro=found}}
In fact in those cases several parameter would be useful: for 0 and 1 counts.
pre>0found
2. We want to use count in {{#if function}}: in that case it will be null=
Yury Kaktov (talk) 04:03, 5 August 2012 (CEST)
Just in case ...
Available work-around(s):
{{#ifeq: {{#ask: [[Property::Value]] | format = count }} | 0 | case: Is Zero (just add Zero case pretty print here) | case: Is Not Zero (enclose same #ask-count-code together with additional pretty print) }}
Or alternatively:
{{#if: {{#ask: [[Property::Value]] }} | case: Data found == none zero-count (enclose #ask-count-code together with additional pretty print) | case: No data found == zero-count (just add Zero case pretty print here) }}
_#switch also comes to mind ... but did not checked/tested that one.
If needed one could create a template to take care of the default stuff. So one could use something like this.
{{count_pretty_print | <#ask-count-call> ... or perhaps just the property input data (speculative/untested). | <zero pretty print text> | <None-zero leading pretty print text> | <None-zero trailing pretty print text> }}
Hello,
I'm trying to get the actual number of pages which are in a category with following query :
{{#ask: [[Category:a category]] |format=count}}
Unfortunately, the results includes redirected pages and thus is superior to the right result expected.
How can I exclude redirected pages from this query ?
Thanks,
Nicolas NALLET (Sémantiki)
I have also seen it on one particular query, [0] suggests a patch and it would be great if you could apply/test/verify this before we make an effort to push this into the master branch.
[0] https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues/1301