$loadcols $colcount

Doug Easterbrook doug at artsman.com
Sun Apr 17 21:05:34 UTC 2022

hi Martin,

you don’t say what you are trying to accomplish where you need to know the number of columns, and I suspect you are trying to do something generic… that this may not be the right answer for.

I find it rare these days to load items from a list into the current record buffer (which is what $loadCols does).

if you are processing things from a list you can always refer to things like below


however, if you must load the data into the local variables (or current record buffer)...

there are some old style command that just work.


the first 3 commands are great in a method, so that it restores the list considered the current one back to being the current one.    its a bit lick a stack and well worth reading about what reversible blocks do.  they are an ancient omnis feature that is still useful periodically

begin reversible block
 set current list lTableClassColsList
end reversible block

once you ’set the current list’ to ‘lTableClassColsList’, you can use a 'for each line in list’. this iterates the current list.

it is almost like   For lLineNum from 1 to  lTableClassColsList.$linecount, except it works on the current list

the ‘load from list’ is like.   Do lTableClassColsList.[lLineNum].$loadcols(

for each line in list
 load from list
end for

now, also not sure if you are aware that using lTableClassColsList.$line as the iterator (instead of lineNum) means you can take the [lineNum] out of the load cols.   bur you still nead to specify what coluns you wnat to load into the current record buffer


For lTableClassColsList.$line from 1 to  lTableClassColsList.$linecount        
    Do lTableClassColsList.$loadcols(lCol01,lCol02,lCol03,lCol04,lCol05,lCol06,lCol07)            
End For  

I’ve mentioned current record buffer.        Thats an omnis concept, also from days gone by — still useful if you want ot use them.  they are really a separate variable

for example.  referring to 

lTableClassColsList.100.iCol01.  means iCol01 in line 100 of the list.

this is not the came as iCol01.  (which is a separate variable).

 when you do   lTableClassColsList.100.$loadcols(iCol01)

it is effectively the same as doing

calculate iCol01 as  lTableClassColsList.100.$loadcols(iCol01)

and thats because the two variables occupy different memory.

if you are using smart lists and SQL — you almost never need to do a $loadcols.

i you are using omnis DML and file formats, you will may need to use $loadcols from time to time

Doug Easterbrook
Arts Management Systems Ltd.
mailto:doug at artsman.com
Phone (403) 650-1978

> On April 17, 2022, at 12:28 PM, Martin Obongita via omnisdev-en <omnisdev-en at lists.omnis-dev.com> wrote:
> Hi all,
> I have the line of codes shown below to populate values from a list into local variables using the command $loadcols
> For lLineNum from 1 to  lTableClassColsList.$linecount        
>     Do lTableClassColsList.[lLineNum].$loadcols(lCol01,lCol02,lCol03,lCol04,lCol05,lCol06,lCol07)            
> End For        
> How do I assign the columns depending on the number of columns in the list using lTableClassColsList.$colcount?        If $colcount =1 then Do lTableClassColsList.[lLineNum].$loadcols(lCol01)        If $colcount =5 then Do lTableClassColsList.[lLineNum].$loadcols(lCol01,lCol02,lCol03,lCol04,lCol05)        
> If $colcount =3 then Do lTableClassColsList.[lLineNum].$loadcols(lCol01,lCol02,lCol03)        
> If $colcount =10 then Do lTableClassColsList.[lLineNum].$loadcols(lCol01,lCol02,lCol03,lCol04,lCol05,lCol06,lCol07,lCol08,lCol09,lCol10)
> Etc...
> This is manual coding. Is there a $sendall type of command to load columns in a smart and clean way?
> As always, I appreciate your KIND helps.Rgds, Martin.
> _____________________________________________________________
> Manage your list subscriptions at https://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 

More information about the omnisdev-en mailing list