?
---
I've got a data schema which represents an xml document like:
....
<purchases>
<purchase>
<category></category>
<item></item>
<price></price>
</purchase>
</purchases>
....
There can be an unlimited number of purchases.
I'd like to create a repeating table which lists all the categories
and sums up the prices. Something similar to the SQL statement:
Select category, sum(price) from purchases group by category.
Is this possible with my existing schema?
I've though about adding another repeating element:
<category_name></category_name>
And adding categories as purchase/category is modifed, then I can
create a repeating table of category_name, with an expression box to
sum up the totals. This is where the problem came up. With a schema
like I've shown, I can't seem to get what I want. I tried an XPath
expression like sum(../../purchase[category=category_name]/price), but
infopath complains that purchase/category_name cannot be found. It
appears that items referenced in the []'s are relative to purchase?
instead of the initial context of the xpath. Can anyone help?
....
<purchases>
<purchase>
<category></category>
<item></item>
<price></price>
</purchase>
</purchases>
....
There can be an unlimited number of purchases.
I'd like to create a repeating table which lists all the categories
and sums up the prices. Something similar to the SQL statement:
Select category, sum(price) from purchases group by category.
Is this possible with my existing schema?
I've though about adding another repeating element:
<category_name></category_name>
And adding categories as purchase/category is modifed, then I can
create a repeating table of category_name, with an expression box to
sum up the totals. This is where the problem came up. With a schema
like I've shown, I can't seem to get what I want. I tried an XPath
expression like sum(../../purchase[category=category_name]/price), but
infopath complains that purchase/category_name cannot be found. It
appears that items referenced in the []'s are relative to purchase?
instead of the initial context of the xpath. Can anyone help?