How to upload and get the bulk data (Datatable or other object) to and from a queue in orchestrator ?
Studio - Install Uipath.Web.Activities package and import Newtonsoft.Json namespace
- Robot - Provision the bot to the orchestrator
- Orchestrator - A queue has to be exists in the same orchestrator where robot is provisioned
Step by step guide
To upload a bulk data like an excel with 50 columns and 1000 rows, there is always a need to create 50 arguments(columns) to the Add Queue Item activity. It has to be hard-coded and needs an eye whenever there it needs a modification. As there is no explicit way of adding a bulk data to queue, following is one of the ways to upload and consume them back:
Adding items to queue:
- Serializing the datatable as JSON: Assign
String strJson = JSONConvert.SerializeObject(dt)
- Add strJson in the queue as argument with some name (Say arg1) using Add Queue Item activity
Where dt is a datatable to be uploaded in the queue.
Consuming from queue:
- Get the item from queue using Get Transaction Item activity and save to (transItem) variable of type UiPath.Core.QueueItem
- Assign :
strJson = transItem.SpecificContent("arg1").ToString
- Deserialize the strJson back to datatable using Deserialize JSON activity with TypeArgument as Datatable
We have an activity Bulk add Queue Item with the UiPath.System.Activities v19.4.0
Note: The above steps are applicable to upload/download whole excel data(DataTable) to/from a single TransactionItem.