Table Properties

Doug Easterbrook doug at artsman.com
Mon Aug 28 18:18:59 UTC 2023


or, in addition to what Andy says ….  you can set the main table in a variable in the $construct of the table class…

and make your own accessor method.


We do both.

all our sql tables are defined based on a table or query class.     The query class can have files across multiple tables.

so, in the $construct, we might

calculate iMainTable as ‘MyTable’

or we might automate it to look at the first variable in the query class (since you know that)…



and then we’d make a method like

$getMainTableName 
    Return iMainTable


and to use it, you can do

do list.$getMainTable returns theMainTable



the great thing about table classes is that you can have your own methods and instance vars.  How you set things up is up to you.             but the concept of instance vars and accessor methods (or setter methods) ….    worthwhile using.



There will be talks at Euromnis  about making table classes generic, improving performance and sample code.   its well worth coming.





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

> On Aug 28, 2023, at 8:47 AM, TBS <andyh at totallybrilliant.com> wrote:
> 
> You can also try :
> 
> Calculate #S5 as dataList.$sqlclassname - which - although not the table name, if you are careful in your sqlclassnames can be used to get to the table name !!!
> 
> Andy Hilton
> Totally Brilliant Software Inc
> Phone (US) : (863) 409 4870
> Phone (UK) : 0207 193 8582
> Web : www.totallybrilliant.com
> Helpdesk : https://totallybrilliantsoftware.supportsystem.com/
> Email : andyh at totallybrilliant.com
> On Aug 28, 2023, 10:28 AM -0400, Martin Obongita via omnisdev-en <omnisdev-en at lists.omnis-dev.com>, wrote:
>> Hi Kelly,
>> If I right click on the iDataRow and select interface manager then I click the properties tab, I can see $desc and $name in the list in red color.
>> Martin.
>> 
>> 
>> 
>> On Monday, August 28, 2023 at 11:23:13 AM GMT+3, Kelly Burgess <kellyb at montana.com> wrote:
>> 
>> Hi Martin,
>> 
>>> I have an instance variable list its subtype defined as a table class.
>>> I am able to get its table name property with the command:
>>> Calculate iTableClassServerName as iDataRow.$servertablenames
>>> I have tried to get its properties below but fails:
>>> Calculate iTableClassServerName as iDataRow.$desc
>>> Calculate iTableClassServerName as iDataRow.$name
>> 
>> What kind of properties are you wanting to see?  I don't think $desc is a valid property of a list or row.
>> 
>> If I inspect a table instance, $name is the name of the table instance.
>>     Set reference tref to $clib.$tables.tAddresses.$insts
>>     Set reference tref to tref._____284_tAddresses
>>     Calculate #S1 as tref.$name        ##  "_____284_tAddresses"
>>     Calculate #S2 as tref.$ident        ##  613
>> 
>> If I inspect a list, $name is the name of the list.
>>     Do dataList.$definefromsqlclass('tAddresses',,tSessionRef)
>>     Calculate #S3 as dataList.$name        ##  "dataList"
>>     Calculate #S4 as dataList.$servertablenames    ## "addresses"
>> 
>> Are you wanting to see session properties?
>> 
>>     Calculate #S5 as dataList.$sessionobject.$damname    ## "FRONTBASEDAM"
>>     Calculate #S5 as dataList.$sessionobject.$transactionmode        ## "kSessionTranManual"
>> 
>> I don't think there's a way to obtain the Table classname directly from a list - you'd need to infer it from $servertablenames, based on your naming conventions.
>> 
>> Kelly
>> 
>> 
>> _____________________________________________________________
>> Manage your list subscriptions at https://lists.omnis-dev.com
>> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
>> 
>> _____________________________________________________________
>> Manage your list subscriptions at https://lists.omnis-dev.com
>> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
> _____________________________________________________________
> 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