I have DT with Species and Status as below.
I would like to export using LINQ to array based on status.
One array for Threatened Species, One for endangered, and one for proposed.
Thank you for your help.
This would be a complicated LINQ query, if it’s even possible. Easier to understand doing it with activities.
Load your data into DT_Main
Create a dictionary Dict_Tables(of string,System.Data.Datatable) (make sure to initialize it in the Default value of the variables pane)
For Each Row in Datatable: DT_Main.DefaultView.ToTable(true,“Status”)
Assign Dict_Tables(CurrentRow(“Status”).ToString) = New System.Data.DataTable (this intializes the datatable inside the dictionary)
Filter Data Table from DT_Main into to Dict_Tables(CurrentRow(“Status”).ToString) with the filter being “Status” = CurrentRow(“Status”).ToString
After this runs, you’ll have a dictionary of datatables based on Status, and the code is completely dynamic - you could add another status to the original data and it’ll just pick it up and create a datatable for it.