Mule ESB DataMapper: Aggregation of field conditional to field type

孤者浪人 提交于 2020-03-16 09:21:04

问题


Mule ESB DataMapper: Aggregation of field conditional to field type

I have the following structures:

Strcuture A:

<itemlist>
  <item>
    <id>123</id>
    <price>1</price>
    <quantity>1</quantity>
    <type>AAA</type>
  </item>
  <item>
    <id>124</id>
    <price>2</price>
    <quantity>1</quantity>
    <type>BBB</type>
  </item>
  <item>
    <id>125</id>
    <price>3</price>
    <quantity>1</quantity>
    <type>BBB</type>
  </item>
<itemlist>

Structure B:

<totals>
  <total>
    <totalPrice>3</totalPrice>
  </total>
</totals>

If I want a sumation of all the field, but only for structures with a of "BBB".

Can I do this in Mule ESB, and if so how would I do it?

Thanks


回答1:


Use a rule, like described in a your previous question, but use the following xpath: sum(//price[../type='BBB']).



来源:https://stackoverflow.com/questions/27988341/mule-esb-datamapper-aggregation-of-field-conditional-to-field-type

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!