ive been thinking on this myself for a while. im not sure exactly how it would be implimented, however. i would think the best way to specify it would be something like
<ask format="table">

where [{...}] is a special code that tells the SMW parser to include that information at the end of the table. the attribute in the parenthesis would probably have to be a required attribute, just as it is when you specify order.

or, alternatly (and probably easier to impliment), there could be another parameter passed to ask. something like
<ask format="table" foot="SUM(%2)">...</ask>
where "%2" referes to the second column of text displayed, not including the title (and would display below the second column. seperate with "|" maybe?). it could also be like
<ask format="table" foot="SUM(%amount)">...</ask>
although i believe this would be harder to impliment.

if one of the developers (or a few users) deem this useful, i would be more than happy to attempt this and share my results.

hope this was helpful
Christopher Baker

On 10/2/06, Tony Bowden <tony-swiki@kasei.com> wrote:

What's the current thinking on being able to write queries that include
some sort of aggregate (SUM, COUNT, MIN, MAX, etc.)?

As I believe I've mentioned here before (and have recently been blogging
about[1]), our company now uses Semantic Mediawiki as its finance
software. The data-entry side works really well, but most of the reporting
we want involves digging directly into the database.  I know I'll have
to keep a close eye on changes to the underlying structure etc., but
it's simple enough, and well worth it.

However, there a few places where it would be really useful to be able
to use some simple functions. Even just totals would be very useful. For
example, we have <ask> queries that show all the Cheques deposited in a
particular Bank Lodgement. On the Bank Statement this shows as a single
line item, with a total, so to make it work we currently have to enter
the total as an attribute of the Lodgement. This is possible to get
wrong, however, so it would be nicer if there was some built in way to
get the total of all the cheques in that Lodgement.

Ideally we could use the result in an attribute of its own, so that it
could be queried elsewhere:


On page 'Lodgement 2039'

[[lodgement total:=<ask headers="hide">
   [[gross amount:=SUM(+)]]

But even if this isn't possible, it would still be handy to be able to
add a row to the end of the "Show me all Cheques included in this
lodgement" table that we already display on that page anyway. Then, even
though we still need to enter the data, it will at least be more
apparent when it doesn't match the actual total of the cheques.

I'm not so sure what the syntax would be for specifying this, though.




[1] http://nothing.tmtm.com/archives/2584 & previous (referenced within)

Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
Semediawiki-devel mailing list