Suggest a linq expression to add ' infront of second column of the DT

Suggest a linq query to add ’ infront of second column of the Data table so that second column data would be in same format.

Hi @Gopi_Krishna1

Could you share a sample input and output required?

Thanks,
Srini

Hi @Gopi_Krishna1,

Use this in Invoke Code activity:

dtFinal.AsEnumerable().ToList().ForEach(Sub(row) row(1) = "'" & row(1).ToString())

Input:
image

Output:

image

Thanks,
Ashok :slight_smile:

Hi @Gopi_Krishna1 ,

Try this

(From row In Final_Dt.AsEnumerable()
Let newValue = "'" & row.Field(Of String)("yourcolumn_name")
Let otherValues = row.ItemArray.Skip(1).Select(Function(x) "'" & x.ToString()).ToArray()
Select Final_Dt.Clone().Rows.Add({newValue}.Concat(otherValues).ToArray())
).CopyToDataTable()

Regards,
Vinit Mhatre

1 Like

My first column is replaced with second column, please fix that :relieved:

Can you share me your input data and expected output

I have modified my code my myself thanks vinit😊

1 Like

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