Quantcast

Math formats except count not recognized

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Math formats except count not recognized

Lloyd Rutledge
Hi all,

I can seem to get math formats working, such as format=sum. format=count works fine, the rest don't. Perhaps because count does not process the numbers themselves. When I run an {{#ask}} with format=sum i just get the default table back, as if it was format=fubar.

I test on this query from the SWM.org example:

{{#ask: [[Category:City]]
| ?Population
| format=sum
}}

with this code on the other pages:

Amsterdam:
[[Category:City]]
[[Population::783,364]]

Berlin:
[[Category:City]]
[[Population::3,391,409]]

Property:Population:
[[Has type::Number]]

And I still get back the table:
  Population
Amsterdam 783,364
Berlin 3,391,409

I tried both 1.7.1 and 1.8 for SMW and Result Formats, but it stays the same. Although the same code works on the SWM.org example.

Any ideas what I'm doing wrong?

-Lloyd
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Math formats except count not recognized

Lloyd Rutledge
A workaround is this:

{{#expr:
 {{#ask:
  [[Category:City]]
  | ?Population
  | headers   =hide
  | mainlabel =-
  | sep       =+
  | limit     =999
 }}
}}

using #expr: from the ParserFunctions extension. Is wordier than format=sum, but can be extended to a wide variety of expressions.

But I'd still be thankful if anyone has insight into why format=sum doesn't work for me.

-Lloyd
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Math formats except count not recognized

Yaron Koren-2
Hi Lloyd,

My guess is that you don't have the "sum" format enabled, for some reason.
If you go to the page Special:Ask, does it show up in the dropdown for
formats?

"sum", and the other mathematical formats, are enabled by default, but you
might have disabled it accidentally if you modified $srfgFormats in
LocalSettings.php.

-Yaron

On Fri, Sep 28, 2012 at 4:15 AM, Lloyd Rutledge <[hidden email]>wrote:

> A workaround is this:
>
> {{#expr:
>  {{#ask:
>   [[Category:City]]
>   | ?Population
>   | headers   =hide
>   | mainlabel =-
>   | sep       =+
>   | limit     =999
>  }}
> }}
>
> using #expr: from the ParserFunctions extension. Is wordier than
> format=sum,
> but can be extended to a wide variety of expressions.
>
> But I'd still be thankful if anyone has insight into why format=sum doesn't
> work for me.
>
> -Lloyd
>
>
>
> --
> View this message in context:
> http://wikimedia.7.n6.nabble.com/Math-formats-except-count-not-recognized-tp4986227p4986303.html
> Sent from the Semantic Mediawiki - User mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Got visibility?
> Most devs has no idea what their production app looks like.
> Find out how fast your code is with AppDynamics Lite.
> http://ad.doubleclick.net/clk;262219671;13503038;y?
> http://info.appdynamics.com/FreeJavaPerformanceDownload.html
> _______________________________________________
> Semediawiki-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/semediawiki-user
>



--
WikiWorks · MediaWiki Consulting · http://wikiworks.com
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://ad.doubleclick.net/clk;258768047;13503038;j?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
Semediawiki-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-user
Loading...