Collection Manipulation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
18-07-20 09:17 AM
1) I have declared a empty collection with no fields and rows added to it, I have to add field names and value (1 row) to this blank collection at run time. How can we do the same. Assume field names and values will be available in another collection with fieldname, values column ex. fn | val1, ln | val2 .....multiple rows.
Input collection -
fn|val1
ln|val2
fn1|val3
ln1|val4
Output collection -
fn|ln|fn1|ln1
val1|val2|val3|val4
2) I have a parent collection with 1 field which is again a collection having 2 text fields. So collection -> collection -> text, text. This structure is defined in parent collection declared and no rows are added. At run time I have to add a row to child collection and add value to 2 text fields. Can we achieve this without adding any other collection to object except the one (parent) that was declared initially. Is there a way to add row to child with something like parentcoll.childcoll and then add values to fields. I am able to add row to parent coll but after that when adding row to child doesn't work.
------------------------------
Mayank Goyal
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
20-07-20 02:43 PM
1. Call Add Row and add a row to the Output Collection.
2. Loop over the input collection.
3. Call Append Field on the Output Collection, the Field Name will be [Input Collection.Field1] and Value will be [Input Collection.Field2].
4. End loop
2) I have not found a way to do this directly. Typically, I copy the child collection into its own collection, make the modification, then copy it back into the parent collection. The result is the same, but it is an extra step. It would be nice if Blue Prism were more cognizant of child collections in this regard.
------------------------------
Nicholas Zejdlik
RPA Developer
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
20-07-20 05:17 PM
------------------------------
Mayank Goyal
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
20-07-20 05:24 PM
I don't think you can with the stock Blue Prism objects; I believe the stock Collection Manipulation object only has text and numeric.
I wrote my own version of Append Field which allows you to add any type to a collection. I know you are looking for a non-custom coding solution, but just in case it might be useful, here's what I have:
Inputs:
Collection In (Collection)
Name (String)
Type (String)
Value (String)
Outputs:
Collection Out (Collection)
' Adds a field of the specified type to the collection. ' The type names must be specified with the system prefix. For example, System.String, ' System.Int32, etc. Collections are special and using the keyword "Collection" or ' "System.DataTable" will suffice. If Type_Name.ToUpper = "COLLECTION" OrElse Type_Name.ToUpper = "SYSTEM.DATATABLE" Then Collection_In.Columns.Add(Name, GetType(DataTable)) Else Collection_In.Columns.Add(Name, Type.GetType(Type_Name, True)) End If If Not String.IsNullOrEmpty(Value) Then For Each Row As DataRow In Collection_In.Rows Row(Name) = Convert.ChangeType(Value, Type.GetType(Type_Name, True)) Next End If Collection_Out = Collection_In
------------------------------
Nicholas Zejdlik
RPA Developer
------------------------------
