How Append Data in column of Data table using Linq Query

Hello All
we want to append " ’ " in each row of the column"Data" of data table DT1 without using For each row. Kindly provide us Linq query for same.

HI @Ripusudan_Sharma ,

You want this character to be appended in the starting of value or at the end of value in Data column.

Thanks

Hi @Ripusudan_Sharma,

You can try with the below LINQ:

(From x As datarow In YourDTName Where x("ColumnC").ToString.Equals("Open") Select YourDTName.clone().rows.Add({x("Data").ToString+" ' ",x("ColumnB"),x("ColumnC")})).copytodatatable

I hope this solves your query.

Regards,
@90s_Developer

Hi @Ripusudan_Sharma ,

Take a Clone of your original Dt say in out_DT in a assign activity.
Then use something like -

(From row In dt_Data
Let a = String.Concat(" ’ ",row(“Data”))
Select out_Dt.Rows.Add(a,(column 2),(column 3)…)
).CopyToDatatable

dt_Data - original DT
The value of variable “a” in `

Select out_Dt.Rows.Add(a,(column 2),(column 3)…)

` will depend upon the position of column Data in your original DT

Thanks

Hi

You need to write expression in Invoke Code activity.

InputDT.AsEnumerable().ToList().ForEach(Sub(row) row(“ColumnName”) = “ ‘ “+row("ColumnName").ToString)

Note: Create one argument for Invoke Code activity and mention properties as below.

Name - InputDT
Direction - In
Type - DataTable
Value - InputDT

Hope this would help you resolve this
Cheers @Ripusudan_Sharma

at Start

hello This is giving
Invoke code: Exception has been thrown by the target of an invocation

Error

Hi

Check once with the arguments been passed
@Ripusudan_Sharma