Table Properties

Doug Easterbrook doug at artsman.com
Wed Aug 30 17:33:47 UTC 2023


hi Martin:

 I did a little test

I defined a list based on a table class (or query class if you prefer) that is in my application.  YOu can copy it to see wha you get (use your own table)

when I run this, #L1 (a list) is defined on my table class.
#S4 is the $desc for the table that I set using the IDE.    NOTE, I explicitly asked for the $desc using the long notation path name 

However, if I ask for $L1.$desc, I get nothing.  

CONCLUSION:   when you instantiate the table class a a list in #L1, the $desc is not copied or available in #L1 by the omnis when instantiating it.

Do #L1.$definefromsqlclass('tF_Letters’)
Calculate #S4 as $clib.$tables.tF_Letters.$desc
Calculate #S5 as #L1.$desc


the second test was to copy the list to a row.   
I”m able to get the $servertablenames and $sqlclassname

Calculate testRow as #L1
Calculate #S1 as testRow.$servertablenames
Calculate #S2 as testRow.$sqlclassname

the third test was to attempt to set $desc for the instantiated row .. and then read it.    Apparently omnis doesn't let you SET or GET  $desc for an instantiated version of the table.   its just not a property in the instantiated row you can manipulate

Calculate testRow.$desc as ‘hello'
Calculate #S2 as testRow.$desc


So, what can we do, if we want to get the $desc of the original table class tF_LETTERS within each of the tables.

In my table class tF_Letters, I have a method that sets some values based on the values of the class that I’m instantiating from.

iClassName will be ’tF_letters’ (the class we are defined from)
iClassDesc will be the $desc of the class that we are defined grom

Calculate iClassName as $cinst.$class().$name
Calculate iClassDesc as $cinst.$class().$desc


the above gets and saves the values within the table class.


that means if you want them within the list #L1 instantiation of the table class , you can easily get them.
if you want them OUTSIDE the #L1 instantiation, you need an accessor method such as 

calculate #S1 as  #L1.$getClassDesc   ## which returns the value of iClassDesc


so, if that helps, you can to

Calculate testRow as #L1
Calculate #S1 as testRow.$servertablenames
Calculate #S2 as testRow.$sqlclassname
Calculate desc as testRow.$getClassDesc


now….  if you need the desc in your code in the manner above, where ‘desc’ is part of the code you are running, I might suggest that needing that variable outside ’testRow’ means that you are possibly not encapsulating your table class object and you it would be better to NOT get that value.

for example, if you are getting that value to put as part of error messages using some edit checsk, then those edit checks should be in the table class, and all you do it call a method in testrow that verifies the data and returns the error message.


thats just me and what I’d do.

obviously you wanted the description of your main table class for some reason. — this is how you get it

1) within the instantiated list (like #L1)
2) outside the instantiated list using a $getMethod


and omnis does not COPY the $desc to the instantiated version and you cannot set it.   .. thats something I learned.    if its something you want to do, raise a bug with omnis.



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

> On Aug 30, 2023, at 9:21 AM, Martin Obongita via omnisdev-en <omnisdev-en at lists.omnis-dev.com> wrote:
> 
> Hi Phil
> "what description were you hoping for?"
> 
> I have an instance variable iDataRow of type Row and subtype taPeople. "taPeople" is created as a table class. This table class has properties. How do I get the properties of "taPeople" table class? OR, asked in another way, how do I get the any property of any class that I have created in Omnis? Properties such as name, desc, version etc?
> Seems like my communication skills are wanting. Forbear with me.
> Martin.
> 
> 
> 
> 
>    On Wednesday, August 30, 2023 at 01:04:19 PM GMT+3, Phil (OmnisList) <phil at pgpotter.co.uk> wrote:  
> 
> Martin,
> 
> I'm trying to understand your original question...
> 
> Calculate iTableClassServerName as iDataRow.$servertablenames
> Gets the server table name...
> the name of the table on the server...
> 
> iDataRow.$desc
> There is no description of that table on the server... unless you use 
> SQL to define the SQL table?
> (ie maybe you can use $createnames() on iDataRow )
> what description were you hoping for?
> 
> If you want the desc of the schema, then you need to find the schema 
> first...
> Calculate iTableSchemaName as iDataRow.$sqlclassname
> 
> or directly the $desc
> Calculate iSchemaDesc as $schemas.[iDataRow.$sqlclassname].$desc
> 
> iDataRow.$name
> What name are you looking for?
> 
> regards
> Phil Potter
> Based in Chester in the UK.
> 
> On 30/08/2023 03:46, Martin Obongita via omnisdev-en wrote:
>> My reading of your answers mean that there is no way in Omnis you can return the property of a class without manually coding it.
>> Properties of a window class include aligntogrid, alwaysenabledobject, cancelkeyobject etcProperties of a table class include allowrowsfetched, canremotedebugwhenlocked etcProperties of an object class include canremotedebugwhenlocked, classtype, collectperformancedata etcProperties of a report class include alightogrid, callprintonexport, canremotedebugwhenlocked etc
>> 
>> 
>> These are the properties of a class I would wish to return from a call.
>> BEST.
>> 
>> 
>> Sent from Yahoo Mail for iPhone
>> 
>> 
>> On Monday, August 28, 2023, 9:19 PM, Doug Easterbrook via omnisdev-en<omnisdev-en at lists.omnis-dev.com>  wrote:
>> 
>> 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
>>>> 
>>>>   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