UiPath Guid LINQ Query

I am having a datatable and in the datatable I have added one column “References”.
In that column I want to add random values using guid.newguid.tostring
Suggest me a linq query to do so.

Also suggest me some good .expression query to add the value


How about the following?

r("Reference")= Guid.NewGuid.ToString
End Sub

Sample20240209-2.zip (3.0 KB)


1 Like

The output will be in datatable ?

Yes, as the following.


' Assuming you have a DataTable variable named "dataTable"

' Check if the "References" column exists, if not, add it
If Not dataTable.Columns.Contains("References") Then
    dataTable.Columns.Add("References", GetType(String))
End If

' Populate the "References" column with random GUID values using a For Each Row loop
For Each row As DataRow In dataTable.Rows
    row("References") = Guid.NewGuid().ToString()


Hey @Ritaman_Baral
try this vb code:

Dim newDT As DataTable = dt.Clone()
For Each row As DataRow In dt.Rows
    Dim newRow As DataRow = newDT.NewRow()
    newRow.ItemArray = row.ItemArray
    newRow("References") = Guid.NewGuid().ToString()
dt = newDT

Hi, You can use VB code

Dim column As New DataColumn(“References”, GetType(String))

For i As Integer = 0 To dt.Rows.Count - 1
dt.Rows(i)(“References”) = Guid.NewGuid().ToString()

please check below workflow

Sequence.xaml (6.8 KB)

we would like to share with you the following learning resource as we have noticed, that you are much interested in LINQ within this topic, and your others

[HowTo] LINQ (VB.Net) Learning Catalogue - Help / Something Else - UiPath Community Forum