Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

Efficient extraction of selected rows from a Edit Table

Very broad use case:
I have an Edit Table that contains thousands of entries. The user has the facility to multi-select rows in this table for further processing. What this does is toggle a hidden non-databound column in the Table called, lets just say, 'Selected' to True$

What we currently do is loop through the whole list to identify the few lines that are selected.

Is there a way to immiately identify those lines? Basically a BTree.Extract for a non databound array...

Comments

  • edited June 2023
    Chances are someone else will provide exactly the answer you're looking for, but in the meantime, you might consider the use of SRP Array to make the job a little quicker.

    I'm thinking
    1. Retrieve the array
    2. Sort by the "Selected" column so the selected rows are at the top
    3. Loop through the sorted rows, stopping once you reach the first non-selected row.
    Doesn't do a select for you but it does prevent you having to look at every row.
  • Makes sense @AusMarkB

    If I am being honest, I have done that once or twice before but didnt even thnk of it this time because I was too busy looking at the trees to see the forest.

    Of course, in the moments since I wrote this trying to get an efficient solution I am told that the new spec would negate me using it anyway since I am going to have to parse the whole thing row by row for coloring and highlighting purposes.
  • @Opto_Will

    If you're immediately identifying the row(s) as the user clicks on them, couldn't you store that row position in a UDP (or other hidden field), and build/manage a list of selected row positions? That would give you access to the selected rows without looping or sorting the array. Actually, you could just store each selected row in an UDP array and skip having to extract the array and pull the rows out.
  • @FrankTomeo,

    That is another good idea. Easy enough to append to and delete from as a toggle.
    Basically maintaining my own index. I like it!
  • Two thumbs up for @FrankTomeo's suggestion. That's the route I'd be going if I was you, especially with the new parse the whole thing requirements.

    Otherwise there'd be a bit of


  • @AusMarkB

    The likeness is uncanny!!!


Sign In or Register to comment.