How to edit linq query?

Now Linq query as below.

dt.AsEnumerable.Where(function(r) r(“Reason Of AA”).ToString()=item).CopyToDataTable()

Output show all table that column name AA no = item

It I want output = datatable column name AA no only.

Please guide me about it.


Can you try Filter DataTable activity as the following? This can filter specific row and column at once.



1 Like

dt.AsEnumerable.Select(function (r) r("Reason Of AA")).ToArray

@kumar.varun2 What type in variable ?

Array of string

dt.AsEnumerable.Select(function (r) r("Reason Of AA").ToString).ToArray

If you want the output in a data table then, build a data table(outDT) using Build Data Table activity with one column of type string and use the following LINQ.

(from r in dt select outDT.Rows.Add(r("Reason Of AA").ToString)).CopyToDataTable


The following will also work, without pre-build datatable, FYI.

dt.AsEnumerable.Where(function(r) r("Reason Of AA").ToString()=item).CopyToDataTable().DefaultView.ToTable("NewTable",False,{"Reason Of AA"})



Perfect Solution!

1 Like

@Yoichi I have more question.

If I want header in output.
How to edit query?

check Add Header property of Write Range activity

1 Like

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