$loadcols $colcount

Martin Obongita martin.obongita at yahoo.com
Sun Apr 17 21:25:22 UTC 2022


 Hi Kelly,
I want to allow the user to select the columns to print from a table using the command
$setTableClassCols_C05Custom

Calculate lTableClassColsList as pTableClassColsList

Calculate lLineCount as lTableClassColsList.$linecount

For lLineNum from 1 to lLineCount

Do lTableClassColsList.[lLineNum].$loadcols(lColValue01,lColValue02,lColValue03,lColValue04,lColValue05,lColValue06,lColValue07)

End For


Do lTableClassColsList.$define(lColName01,lColName02,lColName03,lColName04,lColName05,lColName06,lColName07)

Do lTableClassColsList.$add(lColValue01,lColValue02,lColValue03,lColValue04,lColValue05,lColValue06,lColValue07)

Quit method lTableClassColsList

$setTableClassCols_C05

Calculate lColValue01 as con(pTableClassPrefix,'code')

Calculate lColValue02 as con(pTableClassPrefix,'name')

Calculate lColValue03 as con(pTableClassPrefix,'active_from')

Calculate lColValue04 as con(pTableClassPrefix,'active_to')

Calculate lColValue05 as con(pTableClassPrefix,'activestatus_linenum')

Calculate lColValue06 as con(pTableClassPrefix,'picture')

Calculate lColValue07 as con(pTableClassPrefix,'id')


Do lTableClassList.$define(lColName01,lColName02,lColName03,lColName04,lColName05,lColName06,lColName07)

Do lTableClassList.$add(lColValue01,lColValue02,lColValue03,lColValue04,lColValue05,lColValue06,lColValue07)

Quit method lTableClassList

$initCountries

For lLineNum from 1 to lLineCount

Do lTableClassColsList.[lLineNum].$loadcols(lCol01,lCol02,lCol03,lCol04,lCol05,lCol06,lCol07)

End For

Do iDataList.$definefromsqlclass(iTableClassRef,lCol01,lCol02,lCol03,lCol04,lCol05,lCol06,lCol07)


If he selects 3 then three columns should be loaded.If he selects 20 then twenty columns should be loaded.
Rgds, Martin.


    On Monday, April 18, 2022, 12:03:53 AM GMT+3, Kelly Burgess <kellyb at montana.com> wrote:  
 
 Hi Martin,

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

It's hard to know what you want to do, since the code above just leaves you with the final line's values in those locals, overwriting the previous line's values.

If you don't supply any parameters to $loadcols, then all columns are loaded, but if you need to redirect into other variables then you can supply names.

One approach could be to set up a string of desired variables first.

  Calculate loadColumns as con('$loadcols(',nam(lCol01),',',nam(lCol02),',',nam(lCol03),')')
  Do lTableClassColsList.[loadColumns]

Another would be to work with a copy of the list so you can $redefine the copy's columns to match your local variable names.

Another would be to address the list columns directly, without loading them into locals.

  Calculate someValue as lTableClassColsList.[curLine].C[curColumn]

.. just to name a few.

Kelly
_____________________________________________________________
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