dt_FilteredTableData = (from row in dt_FilteredTableData Let x=New Object(){row(“G/L Account”).ToString,row(“Company Code”).ToString,row(“Post automatically only”).ToString,row(“Only balances in local crcy”).ToString,row(“Relevant to cash flow”).ToString,row(“Blocked for posting”).ToString} select dt_Leadzeros.Rows.Add(x)).copytoDatatable
@kumar.varun2 I have value 0004 in excel while reading and leading zeros is getting missed and only 4 is getting updated in excel after using excel write range… So I want to convert using LINQ
Hi @Mandava_Naresh, I hope you are doing well.
For your problem statement I am attaching a sample workflow which might help you with your solution. LinqQuery.xaml (10.6 KB)
Thank you for response @Shubham_Dutta … File attached by you is concatenating the data in the last row… I just want to convert all rows to string from dt1 using LINQ query and put in new data table dt2 or use converted dt1 directly in excel write range
This is not a problem of the principle but a problem of your implementation.
Probably some typo in column name.
Validate in debug mode the structure of “dt_FilteredTableData”
Hi @Mandava_Naresh,
The process i sent you is a sample for reference in that I am converting one datatable i.e dt to another datatable i.e dtOutput only.Please see the write range activity.
And if you want to change the datatype and check change the datatype in input datatable i.e dt into int32. Still you will get all string values in dtOutput datatable.
I need something like below without concatenation in the end
(from row in dt Let x=New Object(){row(“Name”).ToString,row(“Empty”).tostring,row(“Salary”).ToString,row(“Variable”).ToString,row(“Name”).ToString+row(“Empty”).tostring+row(“Salary”).ToString+row(“Variable”).ToString} select dtOutput.Rows.Add(x)).copytoDatatable
or use just column indexes in the expression to avoid column name trigered error
dt2 = (From row In dt1.AsEnumerable
Select dt2.Rows.Add(CStr(row.item(0)), row.item(1), row.item(2)…)).CopyToDataTable