如何在Blue Prism中格式化嵌套集合

问题描述 投票:0回答:1

我正在从一个API中使用Blue Prism检索一些信息,并且我收到一个集合作为输出。问题是我不希望我的收藏看起来像这样。我想收到一个有一行的集合,其中列出了所有雇员,而不是每1个集合1个雇员。现在,我得到了一个包含许多嵌套集合的集合,每个集合都有1行。我尝试将循环与实用程序集合操作一起使用-复制行以及集合-复制行,但是没有用。谁能告诉我,如何格式化我的收藏集,使其中只有1个包含所有信息的收藏集?最好的问候enter image description here

collections
1个回答
0
投票

[如果您使用的是V6,则可以使用点表示法直接从嵌套集合中获取值(已确认在我的计算机上的v6.4上可以使用,您可以在其中引用活动行数据,像这样

0_Results.JSON:Array.id

这将从活动行中的嵌套集合中提取id值。如果访问数据不是您想要的,并且想将数据转置为一个集合,则可以按照以下步骤操作。

创建馆藏及其结果集合。在集合中定义所需的列。向结果集合添加一行,然后将嵌套的集合解析或转置为保持集合,该保持集合将单行数据输出到结果集合中。

然后您可以将其循环查看集合中存在的所有行。

第二,如果嵌套循环引用对您有用,您还可以只使用计算阶段将每个嵌套集合转置为结果集合,并在每次访问结果集合时添加一行。

我的意思示例:enter image description here

复制到此处的代码,只需将其复制并粘贴到Blue Prism中即可看到它(如果X6和X6的坐标是FYI,那可能是因为它的v6代码,只是因为无法正确读取它们而造成的,它没有损坏,只需单击并拖动它们以重置其值)

<process name="__selection___sandbox"><stage stageid="c77f14c8-f5d9-407f-a640-c8288b067311" name="Start" type="Start"><display x="15" y="-105" /><onsuccess>68da3612-99fd-48aa-8e5f-87e98b60d313</onsuccess></stage><stage stageid="0b03892d-6e8c-459f-a460-ef3c2deacd8b" name="End" type="End"><display x="15" y="345" /></stage><stage stageid="9061b1aa-becf-4335-afc5-bc52e4398833" name="Stage1" type="ProcessInfo"><display x="-195" y="-105" w="150" h="90" /></stage><stage stageid="36ecf838-de7d-4a2c-b376-ef865d3036c3" name="Coll1" type="Collection"><display x="-195" y="-15" /><datatype>collection</datatype><private /><alwaysinit /><collectioninfo><field name="Field2" type="collection" /></collectioninfo><initialvalue><row><field name="Field2" type="collection"><row /><row /><row /></field></row></initialvalue></stage><stage stageid="fa5aa372-f90d-4e71-bdf0-17b58613d666" name="Coll2" type="Collection"><display x="-195" y="30" /><datatype>collection</datatype><private /><alwaysinit /><collectioninfo><field name="Field1" type="text" /><field name="Field2" type="text" /></collectioninfo><initialvalue><row><field name="Field1" type="text" value="some" /><field name="Field2" type="text" value="value" /></row></initialvalue></stage><stage stageid="68da3612-99fd-48aa-8e5f-87e98b60d313" name="store collection into each other" type="Calculation"><loginhibit onsuccess="true" /><display x="15" y="-45" /><onsuccess>8aa44d85-7b12-422d-8e73-086caa454b24</onsuccess><calculation expression="[Coll2]" stage="Coll1.Field2" /></stage><stage stageid="289b8719-8c2a-4dcd-9065-e2a372f69c97" name="Holding Collection" type="Collection"><display x="-195" y="90" /><datatype>collection</datatype><private /><alwaysinit /></stage><stage stageid="b84dacab-9113-44b8-9562-af9244d3a0e0" name="Result Collection" type="Collection"><narrative>Data types are known so make it a defined collection</narrative><display x="-195" y="135" /><datatype>collection</datatype><private /><alwaysinit /><collectioninfo><field name="Field1" type="text" /><field name="Field2" type="text" /></collectioninfo></stage><stage stageid="8aa44d85-7b12-422d-8e73-086caa454b24" name="Loop Start1" type="LoopStart"><loginhibit onsuccess="true" /><display x="15" y="45" /><onsuccess>3c60f50f-8239-4b72-b8f0-a85fa61892fb</onsuccess><groupid>abb7f83d-3fe5-4a94-b482-329c0bef2b2e</groupid><looptype>ForEach</looptype><loopdata>Coll1</loopdata></stage><stage stageid="9e85a5ba-7bec-4ffc-afd7-f893dae57e36" name="Loop End1" type="LoopEnd"><loginhibit onsuccess="true" /><display x="15" y="285" /><onsuccess>0b03892d-6e8c-459f-a460-ef3c2deacd8b</onsuccess><groupid>abb7f83d-3fe5-4a94-b482-329c0bef2b2e</groupid></stage><stage stageid="b9ebc4f4-ce70-4774-ab61-b66e7ab86daa" name="store nested collection into holding collection" type="Calculation"><loginhibit onsuccess="true" /><display x="15" y="165" /><onsuccess>5359c508-e598-485f-82e6-3123354ed4b2</onsuccess><calculation expression="[Coll1.Field2]" stage="Holding Collection" /></stage><stage stageid="5359c508-e598-485f-82e6-3123354ed4b2" name="Parse into result collection" type="MultipleCalculation"><loginhibit onsuccess="true" /><display x="15" y="225" /><onsuccess>9e85a5ba-7bec-4ffc-afd7-f893dae57e36</onsuccess><steps><calculation expression="[Holding Collection.Field1]" stage="Result Collection.Field1" /><calculation expression="[Holding Collection.Field2]" stage="Result Collection.Field2" /></steps></stage><stage stageid="3c60f50f-8239-4b72-b8f0-a85fa61892fb" name="give collection a row" type="Action"><loginhibit onsuccess="true" /><display x="15" y="105" /><inputs><input type="text" name="Collection Name" friendlyname="Collection Name" narrative="The name of the collection to act upon" expr="&quot;Result Collection&quot;" /></inputs><onsuccess>b9ebc4f4-ce70-4774-ab61-b66e7ab86daa</onsuccess><resource object="Blueprism.AutomateProcessCore.clsCollectionActions" action="Add Row" /></stage><stage stageid="ba8aff04-6920-4fc6-bd03-70041755eaba" name="this is set up ignore this" type="Block"><loginhibit onsuccess="true" /><display x="-30" y="-75" w="105" h="60" /><font family="Segoe UI" size="10" style="Regular" color="7FB2E5" /></stage><stage stageid="20e37f34-29e5-495f-9a02-3f87ff0c147f" name="answer in description" type="Block"><loginhibit onsuccess="true" /><narrative>loop over collection with values, push those values into holding collection where you can use a multi calc to target specific columns of data to transpose into the results collection then the loop stage allows you to get as many rows out as you like</narrative><display x="-30" y="15" w="105" h="300" /><font family="Segoe UI" size="10" style="Regular" color="7FB2E5" /></stage></process>

Dex

© www.soinside.com 2019 - 2024. All rights reserved.