-
- Notifications
You must be signed in to change notification settings - Fork 81
Closed
Description
The current way of doing sum/avg feels awkward and clumsy. Since we have 'javascript' custom_func, let it handle aggregation. The idea is to have its argument decl support array:
from:
"total_price": { "custom_func": { "name": "javascript", "args": [ { "const": "num * price" }, { "const": "num:int" }, { "xpath": "number_purchased" }, { "const": "price:float" }, { "xpath": "item_price" } ] }} to:
"total_price": { "custom_func": { "name": "javascript", "args": [ { "const": "var total=0; for (i=0; i<Math.min(num.length,price.length); i++) { total+=num[i]*price[i]; } total; " }, { "const": "num:int:array" }, { "xpath": "number_purchased" }, { "const": "price:float:array" }, { "xpath": "item_price" } ] }} Metadata
Metadata
Assignees
Labels
No labels