I’m preparing for the certification practical, and wanted to try some practices before I start. I’m using the Yearly Report exercise as a starting point, and modifying it some to get comfortable doing things outside the walk-through but I’m stuck on one thing so far:
I’m scraping the Work Items table into a data table, one page at a time just like the Dispatcher in the Yearly Report exercise. I want to filter the data table to only rows that meet a certain criteria, and then add the results to the end of an xlsx file. I don’t want to use the “Filter Data Table” activity - I am trying to put the code together myself to get more proficient.
First I tried just tweaking the existing solution, doing a For Each Row activity to loop through the datatable, and then an if block to test if the current row meets my filter criteria. I get stuck here because i’m not sure what to do with the current row. I tried adding a Remove Data Row activity to the Else block to remove the current row if it doesn’t match my fliter criteria - but apparently you can’t remove a row while you’re in an if block.
I tried using an Assign activity to assign the current data table to a new data table with a filter applied - and this basically worked but it threw an error in the log anytime the filter resulted in no rows being added to the new data table, and I think that’s just bad practice:
dt_Filtered = dt_WorkItems.Select(…criteria…).CopyToDataTable
I’ve tried several other things that I can’t quite remember. I feel like it should be relatively simple to do without having to leverage the built in Filter Data Table activity but can’t quite get there… probably been staring at it too long (and not sleeping enough).
Thanks for any pointers!