Hello,
I need your help again. I have an Excel file that I want to filter by document number “Beleg” and year “GJ”. The file is variable. One time there is only 2022, the next time 2021, 2022 and 2023.
For example, see screenshot. Here I need the output:
DataTable1 = 2021 = 6090289
DataTable2 = 2022 = 6280, 32630, 32631, 32629, 32632
Hi @nina.wenner
the easiest way to achieve this solution is using filter datatable activity.
on ‘GJ’ column and save in separate Dt…
conditions may look like - GJ = 2022 and GJ = 2023.
you can also filter not the unnecessary columns from your datatable.
as we have split the input table into different tables we can go to each table and retrieve the Beleg numbers as the same we can process a datatable e.g. for each row.
In case that you are only interested on the list of Beleg numbers we can also creatre a lookup dictionary where key is the year and value a string list with the corresponding beleg numbers
(From d in YourInputDT.AsEnumerable()
Group d by k=d("GJ").toString.Trim into grp=Group
Let bl = grp.Select(Function (b) b("Beleg").toString.Trim).toList
Select t = Tuple.Create(k, bl)).toDictionary(Function (x) x.Item1, Function (x) x.Item2)