How to convert queueitem to datarow

Hi!

Does anyone have an idea on how to convert QueueItem to DataRow in UiPath? I would need to do that since depending on the setup, the process I’m developing either uses or doesn’t use Orchestrator. In such case it makes life a lot easier to handle the transaction items as Datarows in all cases. Any ideas on how to do the conversion?

2 Likes

Please check DataRow Class (System.Data) | Microsoft Docs

What this means is that you can’t build a data row without a data table, so first build your data table (https://activities.uipath.com/docs/build-data-table) and then add an array created with the queue values, something like {QueueItem.SpecificContent(“name”).toString, QueueItem.SpecificContent(“name”).toString} to that data table using Add Data row (https://activities.uipath.com/docs/add-data-row)

PS. The array should go in the ArrayRow property.

1 Like

Thanks for your answer! However, my QueueItem contains around 60 columns… Basically it’s based on an application form containing 60 data entries that need to be transferred elsewhere. So if I understand correctly, your suggestion would require re-typing that QueueItem.SpecificContent -part 60 times, which seems excessive. I’m looking for a more dynamic solution but haven’t come up with any. Any ideas? If not, then I guess I have to do it according to that specification :smiley:

You could try using https://activities.uipath.com/docs/generate-data-table, generating the table using a queue item converted to string, but not really sure if you can do that without writing QueueItem.Specific content 60 times :frowning: .

Ok, thanks Robert :slight_smile: Still, if someone else has solved this issue, I’ll be glad to hear. Until then, I guess this is the best way to do this conversion. I tried also CType conversion from QueueItem to Datarow but apparently it isn’t allowed…

Hello jt92,

I have a similar need as yours where I have to convert queue item to data row , did you find any other solution except using queueitem.SpecificContent

Hi,
I was working on something similar sometime back where I needed to write the contents of QueueItem variable back to datarow of my datatable/excel. I was able to achieve it as below:

For each (field in dummyRow.Table.Columns)
----dummyRow(field.ColumnName)=queueItem.SpecificContent(field.ColumnName)

It works without having a need to write all column values individually.

There might be a better and more efficient way to achieve same using LINQ queries than having to use For Each loop if someone wants to give it a try.

Hope this helps.

Cheers,
CT

1 Like