Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xml 在mule dataweve 4中查找数组中的索引_Xml_Mule_Dataweave - Fatal编程技术网

Xml 在mule dataweve 4中查找数组中的索引

Xml 在mule dataweve 4中查找数组中的索引,xml,mule,dataweave,Xml,Mule,Dataweave,Dataweave:需要找到数组最大值的索引,并从该索引映射特定元素 <row> <code>3</code> <percentage>0.9723</percentage> </row> <row> <code>4</code> <per

Dataweave:需要找到数组最大值的索引,并从该索引映射特定元素

        <row>
           <code>3</code>
           <percentage>0.9723</percentage>
        </row>
        <row>     
           <code>4</code>
           <percentage>0.0278</percentage>
        </row>
        <row>     
           <code>5</code>
           <percentage>0.0123</percentage>
        </row>

示例:我想导航到每一行,找到百分比最大值的索引,然后从该索引映射代码值

我添加了一个名为rows的包装器元素,使其成为有效的xml,然后您可以使用

%dw 2.0
output application/json
---
payload.rows.*row maxBy ((item) -> item.percentage)

事实上,我需要映射百分比最大的字段代码。您应该修改原始答案以澄清这一点。