Are simple mathematical expressions possible in WQL? Suggestions?

Support Ticket

+status
+tags
 

Is there a way to sum the values stored in two cards of the number type? 

Also, is it possible for a search to display the count of search results?

 

There's no way to do sums in WQL. You could certainly do it with Ruby cards, unfortunately I think they're turned off on cldstr.com-hosted sites?

 

Counts however you can get, with "return":"count" in your WQL, e.g.:

{"type": "User",

 "return": "count"

}

...would get you the number of cards of type User. There's a built-in *count card you can append to any search to get the same result:

*count+*right+*structure:

{"found_by":"_left", "return":"count" }

used like so:

 

I notice this is undocumented on CQL Syntax, I can do so unless we don't want this feature very public for some reason... --John Abbe


We should have some basic math on search results, count is there, but average and sum of numeric fields should be fairly straightforward. I think the issue is representing types that support calculations to WQL, and what operation they support.

  --Gerry Gleason.....2012-10-08 20:44:50 +0000


John's right, the answer is no. With the exception of "count", WQL is for returning lists of cards.

 

In the past our answer for this kind of need was through Ruby cards, as john mentioned, but they are no longer supported (whether on Cloudstore or elsewhere). So currently you would need to write modules for this purpose.

  --Ethan McCutchen.....2012-10-08 22:01:09 +0000


Thanks for letting me know! Much appreciated.

 

Tom

  --Tom McFarland.....2012-10-08 22:03:05 +0000


So Ethan, shall I document count on CQL Syntax?

  --John Abbe.....2012-10-09 06:18:51 +0000


Thanks for offering! Yes, you can start that. Counting actually gets pretty complicated sometimes, but the simple case is straightforward enough.

 

Tom, I should mention that we're available for paid consulting if you've got a use case that you really need. The idea is for Wagn to become a general solution tool, so if you're getting stuck, that's something we need to address!

  --Ethan McCutchen.....2012-10-09 16:51:37 +0000