# Select few fields in QueueItems and convert to Datatable

**URL:** <https://forum.uipath.com/t/select-few-fields-in-queueitems-and-convert-to-datatable/700446>\
**Category:** Studio\
**Tags:** studio, orchestrator\
**Created:** [November 17, 2023, 9:08am UTC](https://forum.uipath.com/t/select-few-fields-in-queueitems-and-convert-to-datatable/700446 "2023-11-17T09:08:45Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![vijayakumarkj](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/vijayakumarkj/32/176675_2.png) [@vijayakumarkj](https://forum.uipath.com/u/vijayakumarkj)\
**Post date:** [November 17, 2023, 9:08am UTC](https://forum.uipath.com/t/select-few-fields-in-queueitems-and-convert-to-datatable/700446/1 "2023-11-17T09:08:45Z")

</div>

Hi All

I have below QueueItems in Queue

Reference : GUID  
Specific Data:  
First Name: UserFirstName1  
Last Name: UserLastName1  
Location: Location1  
…

I want to convert this queueitems (there are many) to datatable, However, I need below fields  
Reference, First Name and Last Name

There are solutions provided in the forum using Linq, but it is not fitting my requirement.

Can you share some ideas using LINQ queries?

Thanks  
VJ

---

<div class="post-metadata">

**Author:** ![ppr](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/ppr/32/464097_2.png) [@ppr](https://forum.uipath.com/u/ppr)\
**Post date:** [November 17, 2023, 9:19am UTC](https://forum.uipath.com/t/select-few-fields-in-queueitems-and-convert-to-datatable/700446/2 "2023-11-17T09:19:17Z")

</div>

based on the following idea

> [@How to convert ienumerable\<queueItem\> to datatable](https://forum.uipath.com/t/how-to-convert-ienumerable-queueitem-to-datatable/513489/4):
>
> We assume that get Queue Item-\>s is used here we would recommend to specify what is needed. QueueItems Properties e.g. Reference, Status,… SpecificContent infos Example: All SpecificContent Dictionaries to DataTable Assign Activity: dtData = JArray.FromObject(YourGetQueueItemsOut.Select(Function (x) x.SpecificContent).toArray).toObject(Of DataTable)

we can extend to handle also QI Properties e.g. Reference

But lets keep in mind: The JSON DataTable gerneration will derive the DataColumn DataTypes by checking first row values. This can lead to unwanted datatype calculations.

But combining different approaches, done in projects came out to reliable results

---

<div class="post-metadata">

**Author:** ![Gayathri\_Mk](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/gayathri_mk/32/181665_2.png) [@Gayathri\_Mk](https://forum.uipath.com/u/Gayathri_Mk)\
**Post date:** [November 17, 2023, 10:23am UTC](https://forum.uipath.com/t/select-few-fields-in-queueitems-and-convert-to-datatable/700446/3 "2023-11-17T10:23:27Z")

</div>

Hi @vijayakumarkj  
use build the data table and create a new data table with the columns required

Then for each row of queue items  
USe 3 assign activities for reference,Firstname,Last name

then use item.SpecificContent(“Reference”).ToString() similarly for first name and last name… to get the values and use add data row to add these values into the data table.

Hope this will help.

---

<div class="post-metadata">

**Author:** ![Anil\_G](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/anil_g/32/524291_2.png) [@Anil\_G](https://forum.uipath.com/u/Anil_G)\
**Post date:** [November 18, 2023, 9:51am UTC](https://forum.uipath.com/t/select-few-fields-in-queueitems-and-convert-to-datatable/700446/4 "2023-11-18T09:51:42Z")

</div>

@vijayakumarkj

please try this

first use build datatable and create a datatable with 3 columns and name it dt

`dt = queueitems.Select(function(x) refdt.Rows.Add(New Object(){x.Reference,x.SpecificContent("FirstName").ToString,x.SpecificContent("LastName").ToString})).CopyToDataTable`

Hope this helps

cheers

---

<div class="post-metadata">

**Author:** ![vijayakumarkj](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/vijayakumarkj/32/176675_2.png) [@vijayakumarkj](https://forum.uipath.com/u/vijayakumarkj)\
**Post date:** [November 22, 2023, 9:48am UTC](https://forum.uipath.com/t/select-few-fields-in-queueitems-and-convert-to-datatable/700446/5 "2023-11-22T09:48:17Z")

</div>

@Gayathri_Mk It should work by adding individual line item to queue using a loop. I was looking for a LINQ query to get the results in data table and add to Queue via bulk upload. Thank you VJ!

---

<div class="post-metadata">

**Author:** ![vijayakumarkj](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/vijayakumarkj/32/176675_2.png) [@vijayakumarkj](https://forum.uipath.com/u/vijayakumarkj)\
**Post date:** [November 22, 2023, 9:51am UTC](https://forum.uipath.com/t/select-few-fields-in-queueitems-and-convert-to-datatable/700446/6 "2023-11-22T09:51:51Z")

</div>

Hi @ppr, I tried to extend your previous response to include Queue Item reference, however it wasn’t successful. Thank you VJ!

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/system/32/182466_2.png) [@system](https://forum.uipath.com/u/system)\
**Post date:** [November 30, 2023, 5:33am UTC](https://forum.uipath.com/t/select-few-fields-in-queueitems-and-convert-to-datatable/700446/7 "2023-11-30T05:33:58Z")

</div>

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
