Is there any functionality in BP where I can delete the 2nd last row after comparing it to the last row at that instance?
Hi AshutoshMahale,
There is no direct functionality but you can apply your own logic to do so.
- Assume your original collection is Collection
1
- Use 'Count Rows' from the Collections VBO. Get it in a Data Item say TotalRows.
- Use 'Copy Rows' of Utility Collection where you need to pass the row index number. This would be TotalRows - 1 for the 2nd last row. This will be copied into another collection - Collection
2. This is a single direct action and no loop is involved here.
I believe the indexes for the collection row start from 0 so take care on that.
- Do the same thing for the last row this time by passing the index number as TotalRows. Copy Rows will overwrite any previous rows in the output Collection
2. So either copy to a new Collection
3 Or
Append to Collection
2.
- Perform the comparison between these two rows depending on whether it is a same or different collection generated in the above step.
Here you can determine which row you want to keep or delete. Lets say you want to delete the 2nd last row.
- Now loop through the original Collection
1. Reach the 2nd last row using a Counter variable. When the Counter will reach TotalRows-1, it is the 2nd last row and now run the Delete action.
If you would not like to go with the ready made available actions as above then you will have to write a Customised Code stage to interact with the Collection and delete the desired row.