cancel
Showing results for 
Search instead for 
Did you mean: 

Pre-define nested collection (DataTable) schema's through C# code

ThomasWarnaar
Level 4
Hi all,

I have a Queue item schema that is quite extensive. In order to prevent errors in the process and queue I want to create a standard collection through a C# code stage where all the fields, subcollections and subcollection fields are predefined and the standard Queue item collection is returned output.

I want to do this by code so I don't have to create tens of BP stages which all add a single field, and thereby keep everything manageable. However I am unable to recreate this possibility programmatically. Basically what I need to do is pre-define the DataTable schemas for the nested DataTables/collections. I am unable to do this however without adding new rows and then importing already defined nested datatable into a column/cell of type DataTable in that row, which is not the same. Also this is a bottom up approach that requires a lot of planning.

What I want to do is create the base DataTable with some columns of type string or boolean, and some columns of type DataTable. Within the DataTable columns I want to pre-define their own columns as well.

Is this possible and if so how? If not, what format does BP use for these nested collections, because they seem to pull it off?
1 BEST ANSWER

Best Answers

ewilson
Staff
Staff
@Thomas Warnaar,

You may have an older version of the Utility - JSON VBO installed. You can find the latest release on the Digital Exchange.

https://digitalexchange.blueprism.com/dx/entry/9648/solution/blue-prism-json-utility

Cheers,
Eric​

View answer in original post

6 REPLIES 6

John__Carter
Staff
Staff
Hi Thomas - take a look at the Utility JSON object. If your C# code stage can generate a JSON string then you'll be able to use the utility to convert the JSON into a collection.
34921.png

ThomasWarnaar
Level 4
Hi @John Carter,

Thank you for your reply. This might be useful, I did not know about this option. I've been trying it out a bit now and I see it creates a JSON:array between every parent and child collection. This is also visible in your screenshot.
Is there then also a possibility to get the net schema as a collection, meaning without the JSON:Array​'s in between the parent child collections?

Thanks!

ewilson
Staff
Staff
Hi @Thomas Warnaar,

There should be a public action on the VBO titled JSON to Collection (skipping JArray).​ That action will create the collection w/o the interim JArray.

Cheers,
Eric

ThomasWarnaar
Level 4
Hi @ewilson,
Our BP install doesn't seem to have that option. Could I maybe import it from somewhere?
I'm wondering now if there are other usefull options we're missing...
Sincerely,
Thomas​​

ewilson
Staff
Staff
@Thomas Warnaar,

You may have an older version of the Utility - JSON VBO installed. You can find the latest release on the Digital Exchange.

https://digitalexchange.blueprism.com/dx/entry/9648/solution/blue-prism-json-utility

Cheers,
Eric​

ThomasWarnaar
Level 4
I got the newest version from your link and it works a treat @ewilson, thank you!