Check If the Amount is 0 True - Use the Insert/Delete Row Activity to delete a row using the row number variable False - Increment the row number variable and go to the next row in the DataTable
NOTE - We do not Increment the row number variable after deleting a row because if we delete a row, the next row moves up
Here is a screenshot of the workflow I would use to delete rows where the Amount Field had 0 in it
Thanks, @Mr_Meeseeks, but since I have to process files with more than ~20K rows it is difficult to use loops; however I’m curious about how you used the activity “Insert/Delete Rows”…my understanding is that it requires a starter position which must be provided by a number…
Absolutely correct! Before looping through each row I assigned a variable equal to 2 for the row number and for the Position property of the Insert/Delete Rows activity I am plugging that variable in.
The Write Range activity would overwrite whatever data was in sheet 1. This is how I would expect the worksheet to look after performing the Write Range activity.
Invoice 4 is overwritten and Invoice 5 is seen twice
Would you consider Writing your filtered range to a new sheet and then replacing it? I agree that loops wont be very efficient for 20k+ rows
You could also use the Insert/Delete Rows activity to delete all of the rows in the worksheet, then perform the Write Range activity using your filtered range on the cleared sheet
dtInput.AsEnumerable().Where(Function(row) Not(row(“Z”).ToString.Trim.Contains(“0”) or row(“Z”) Is DBNull.Value Or row(“Z”).Equals(“”) )).CopyToDataTable
@prasath17 Awesome! I was trying to understand how to use LinQ! I just realized that the approach provided by @Mr_Meeseeks will help me in most cases and LinQ will improve the performance of heavy transactions. Thanks to both of you
@Tana20 - Glad it helped you. Did you already ran this against your 20K rows file?
I had 36K rows file, Filter table taking close 10-15 mins to run(along with the other activities)..Later I changed it to LINQ (after learning thru Forum) my job ran in less than 2 mins.
You refer this post for future filtering queries..
Thanks for sharing that with me, and yes, I was almost there, I was just missing a parameter, but your script did the trick, it ran in 1m for 15K rows!