Find answers, ask questions, and connect with our
community all around the world.

Home Forum Omnis General Forum Removing items from a list with $sendall

  • Removing items from a list with $sendall

    Posted by Uwe Smidt on April 3, 2023 at 8:57 am

    Dear $all,

    I like the power of the $sendall-command, but often it is difficult to find the problem in the syntax – what am I doing wrong here:

    Do iList.$sendall($ref.$remove($ref.$line),ktrue)

    # ktrue is only a placeholder for the time being.

    But so far, $remove does not remove anything – it needs a proper reference to what needs to be removed – – and $ref.$line does not seem to do the job…

    Any ideas?

    Thanks in advance!

    Andreas Pfeiffer replied 11 months ago 3 Members · 3 Replies
  • 3 Replies
  • Marten Verhoeven

    April 3, 2023 at 9:21 am

    Hi Uwe,

    If you do this, you are changing the list lines in the sendall loop itself which will never work. If you use iList, then $remove can be executed (just pass 0 for the current line, you don’t need to add $ref.$line), but it will leave half the lines, just as it would if you would do this in a for-loop, because the line wich is removed will be replaced by the next line, but the loop will continue with the next line:

    Do iList.$sendall(iList.$remove(0),ktrue)

    It is better to use a $search to select lines and then use $remove(kListDeleteSelected).



  • Uwe Smidt

    April 3, 2023 at 9:33 am

    Dear Marten,

    Thank you for your answer!

    My wish to do it in just one line of code seems to be like ‘sawing off the tree branch on which you sit’ – so I’ll do it in 2 lines as proposed by you 😉

    Best regards!

  • Andreas Pfeiffer

    April 3, 2023 at 9:50 am

    Hi Uwe,

    The problem is that you cannot perform a $remove on the list line. Instead you would need to do this on the entire list.

    So if we assume that no line is selected (please note this is different from the current line) then we can simply use the parameter to remove all non selected lines:

    Do lList.$search(1=2) ## remove any selection

    Do lList.$remove(kListKeepSelected)



Log in to reply.