Get specified columns from a data table

Assume, we have a requirement to get specified columns from a data table then we generally delete unnecessary columns to get the actual ones. Instead of this, you can use the below expression with simple assign activity avoiding deletion logic

Variable of type data table outputDT = DT.DefaultView.ToTable(False,“Items”,“ID”)

  • Replace DT with your input data table
  • outputDt is output data table
  • Replace Items,ID with your actual column names that you want to retrieve
  • You can also add additional column names separated by comma.

I hope you enjoyed this article

1 Like