Mule ESB DataMapper:字段 1 乘以字段 2 的聚合
Mule ESB DataMapper: Aggregation of field 1 multiplied by field 2
我有以下结构:
结构A:
<itemlist>
<item>
<id>123</id>
<price>1</price>
<quantity>1</quantity>
</item>
<item>
<id>124</id>
<price>2</price>
<quantity>1</quantity>
</item>
<item>
<id>125</id>
<price>3</price>
<quantity>1</quantity>
</item>
<itemlist>
结构B:
<totals>
<total>
<totalPrice>3</totalPrice>
</total>
</totals>
如果我想要所有字段相乘的总和
通过结构 A 中的字段放入结构 B 的 totalprice 字段中,这在 DataMapper 中是否可行。
如果可以的话,你会怎么做?
谢谢
是的,在数据映射器中找到字段 1 的映射,然后转到脚本视图。在那里您会找到一个数据映射器 MEL 脚本。找到 output.total = input.field1
并添加 * input.field2
.
我有以下结构:
结构A:
<itemlist>
<item>
<id>123</id>
<price>1</price>
<quantity>1</quantity>
</item>
<item>
<id>124</id>
<price>2</price>
<quantity>1</quantity>
</item>
<item>
<id>125</id>
<price>3</price>
<quantity>1</quantity>
</item>
<itemlist>
结构B:
<totals>
<total>
<totalPrice>3</totalPrice>
</total>
</totals>
如果我想要所有字段相乘的总和 通过结构 A 中的字段放入结构 B 的 totalprice 字段中,这在 DataMapper 中是否可行。
如果可以的话,你会怎么做?
谢谢
是的,在数据映射器中找到字段 1 的映射,然后转到脚本视图。在那里您会找到一个数据映射器 MEL 脚本。找到 output.total = input.field1
并添加 * input.field2
.