About nested collections

Daenerys

New Member
H, I've been pulling my hair off as I can't get my nested collection working :( The idea is that the process first fetches an email, saves the attachment csv (Excel) and then starts processing them for queue. The first Excel sheet has information for collection1 and the second sheet for collection2. The collection1 has all the Fields named, and the last of them is a collection field where the collection2 should be added which I've tried with a calculation stage. Up untill that all goes well, but then the calculation gives error that the field is not found in collection1. That is the collection field which is named in Fields list. What am I doing wrong here? I don't get it... All help would be kindly apppreciated. Thank you :)
 

pug

New Member
That sounds doable with a calc-stage as you mention.

Expression: [Coll2]
Store Result in : Coll1.Field2

If it does not work maybe you can share some screen shots with your syntax?
 

Daenerys

New Member
Hi! Thanksk for replying! I include the screenshots here so you may take a look!
 

Attachments

  • Capture1.JPG
    33 KB · Views: 155
  • Capture2.JPG
    81 KB · Views: 121
  • Capture3.JPG
    76.5 KB · Views: 112

pug

New Member
If it is empty it will not work (no Field to add data to) but it should give you something like: "Internal : Could not store calculation result Cannot set MainAsset: The collection has no current row" instead. So There should be something
 

Daenerys

New Member
I ticked all the boxes underneath and now all the tabs are visible. I did another testrun, but still same result: Field R3_Out.MainAsset not found :(
... And the MainAsset field is not visible in Current values after the csv is copied.
 

pug

New Member
If you pre-define the Collection-fields again you can always use the Object: "utility - Collection Manipulation" with Action: "Set Collection Field".

But if you do it like that you probably need to do one action per value. :/
 

Daenerys

New Member
I've tried setting the collection fields, but than only allows adding text field, and since this is another collection it doesn't work. Like you said; by that we'd need to add each field there separately and that is not how we want to do it :(
 

Daenerys

New Member
..Obviously Blue Prism changes the predefined fields and that is why the needed field disappears. I managed to resolve this by creating a temp collection without predefined fields for fetching the data from csv and then using multicalculation for moving the data from temp collection to actual collection without loosing any data :) Mission accomplished!
 
  • Like
Reactions: pug

Sergey

New Member
Hey,

a bit off topic, but I was looking for an answer and stumbled upon this post, hope it helps somebody too. I was looking for how to add a nested collection to another collection in a loop. By default, you can only append text or number field and if you try to add a collection there you obviously will get an error abot No Conversion from Collection to Text. So what I've done:

first you create a new collection with just one field of type "collection". Next, use Merge Collections action with your target collection and that new one. Set your target collection as output collection. Here you go, you know have the field with datatype Collection where you can simply add nested collections by looping and using Calculation stage.

Enjoy!
 
Top