totc(#LSEL) in notation?

Mike Matthews - Omnis omnis at lineal.co.uk
Sun Oct 3 21:29:32 UTC 2021


Hello Das,

The answer is provided in StudioTips.

Select the ‘Lusts’ tab, and then in the list, look at ‘Lists Notation’, and then on the subject line called $selected.

Here is the text from that page for you:

'$selected' tells you whether or not a line is currently selected. Using '$assign' you can select or deselect the line.

      # Is the current line selected?
      Calculate bSelected as List.0.$selected

      # Replace zero with a specific line number to find the selection state any line in the list.

      # Set the current line to selected.
      Do List.0.$selected.$assign(kTrue)
      # Replace zero with a specific line number to set any line in the list.

      # Select all the lines in the list.
      Do List.$search(kTrue)

      # Deselect all the lines in the list.
      Do List.$search(kFalse)

      # You can invert selection for all lines in a list using $sendall.
      Do List.$sendall($ref.$selected.$assign(not($ref.$selected())))

      # Total selected lines in the list.
      Calculate %N as List.$totc(#LSEL)

See $search for some powerful ways to select or deselect list lines.

Mike Matthews

Lineal Software Solutions
Commercial House, The Strand<x-apple-data-detectors://1/1> Barnstaple, Devon, EX31 1EU<x-apple-data-detectors://1/1>

omnis at lineal.co.uk<mailto:mike.matthews at lineal.co.uk>

www.lineal.co.uk<http://www.lineal.co.uk/>

www.sqlworks.co.uk<http://www.sqlworks.co/>



On 3 Oct 2021, at 19:43, Das Goravani <goravanis at gmail.com<mailto:goravanis at gmail.com>> wrote:


I am wondering how to do

Set current list TheList
Calculate #1 as totc(#LSEL)

I looked everywhere and could not find anything on the SELECTED state of a line in a list

How do you ask via notation if a line is selected.. I’m used to #LSEL which relies on the current list

On another note:

Is there a way to use the FOR.. loop to go to selected lines only..

I know how to do it another way, which is fine ie

Do TheList.$first(1)
Repeat
  Some code here
  Do TheList.$next(,1)
Until flag false

That’s how I go through selected lines in a list, is there a slicker way?

I don’t know why this works

For TheList.$line from 1 to TheList.$linecount step 1
End for

I don’t know how it knows that it should go to the line indicated by the counter, or how you all figured that out as it’s not in the online help.. maybe it’s in the manual

It seems that the first value.  TheList.$line.   Is just a counter.. a field that tells it how many iterations to perform

Then again from “from” and “to” argument tells it how many to undertake

But the online docs say the first value is only a counter.. not a pointer or more active agent

Somehow when you put TheList.$line it knows it’s a list, and it goes from line to line making the current line current

It baffles me a bit. But I’m happy to just use it. Thought I’d ask.
_____________________________________________________________
Manage your list subscriptions at http://lists.omnis-dev.com
Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com



More information about the omnisdev-en mailing list