How to add a System.Data.DataRow variable into a work queue?

I am trying to add rows of information extracted from an excel sheet and stored in a datatable into a work queue.

I am using a For Each Row Activity to loop through the data table and I have the Add Queue Item Activity within the body. I have setup a System.Data.DataRow argument within the Item Information section of the Add Queue Item Activity but I keep getting the following error message: “Could not determine JSON object type for type System.Data.DataRow”.

What is the correct method for adding DataRow variables into a work queue?

1 Like

Hi, Did you get a solution for this.

Hi send the screen shot

No we did not, do you have a solution for this?

No, I am adding each row cell into a text variable for the Queue item in Orchestrator.

Does anyone got the solution??

Thanks,
Meg



I think if the variable value doesn’t match then you will get the error like that. In my case for Set Transaction status i need to pass Get Queue Item output variable(System.Collections.Generic.IEnumerable<UiPath.Core.QueueItem>) , instead of that i passed Get Transaction Item Output Variable(UiPath.Core.QueueItem) then I also got the error like “Set Transaction Status: Could not determine JSON object type for type UiPath.Core.QueueItem.” After passing correct values i got the output.

Hello,

I have passed the data row to queue by converting it into JSON string and later while retrieve transaction item I have converted JSON string to datarow,
It worked for me, if any info required let me know.

Thanks,
Meg

1 Like

Hi Meg,

Could you please share your solution?
I have a similar case where DataRows should be added to the queue and retrieved. I have used JsonConvert.SerializeObject(row) in the AddQueueItem activity and looks like that’s working. What I’m struggling with is the deserialization part after GetQueueItem. Deserialize JSON activity fails with error: “Deserialize JSON: Unexpected character encountered while parsing value”

Hello,

Attaching my flow.
TestDatarowString.xaml (23.4 KB)

Thanks,
Meg

8 Likes

Hi Sir,
How to assign the JSONConvert.SerializeObject(MyDT) to Jsonstring in assign activity.if i need to download the any packages for this/or not. Can you please give me brief information on this. And the thanks for provided sample template.

Nice thinking. Thanks!

1 Like

What to do in case of Complete Row which contain 5 to 6 Columns?
Row.item(0).ToString add only single Column value.

Hi @megharajky . When I am doing the Assign I am getting JSONConvert is not declared. Can you give me any hints on this? Thank you!

The error is due to the Newtonsoft.Json namespace not being installed. Go to the import panel and import ir

This has been irking me for ages. I never got a decent answer that works.
The requirement is to start with a DataRow, not a DataTable.
For example using the REF, all you have in Process.xaml is the current row not a dataset/table.
Whether your sourcing from a spreadsheet, database, or queue its the same.
If you serialize a DataRow you get the whole damn table as a property because thats how .NET works.

So here is my offering as a solution : turn the DataRow into an Array and serialize that.

JSONConvert.SerializeObject(in_TransactionItem.ItemArray)

Put that into a Write Line or a Add Queue Item or whatever and see it work :slight_smile:

Your welcome.