Table class receiving scope from windows

Andreas Pfeiffer apfeiffer at familiepfeiffer.de
Tue Jan 30 04:27:43 EST 2018


Hi Das,

Table classes are excellent to encapsulate the code from the window. You would build public method (those with a $-sign as a prefix) or use the inbuilt methods such as $insert etc.

Then you define your row variable as an instance variable within your window or remote form. Let’s say it is called iDataRow. You can either use the subtype of the row point to your table class or you can use the command:

Do iDatarow.$definefromsqlclass($tables.taMyTableName)

For row variables I recommend the subtype.

The row will then use the schema definition that is bound to the table class and you can access your data using iDataRow.columnname. So primarily the dataname of the fields would use this notation (nameOfTheRow.columnName).

If you then need to call a method within your table class - you actually don’t you call a method within your iDataRow:

Do iDataRow.$insert()

Or whatever your method name is.

Inside the table class methods you would replace the name of the row using $cinst instead since the class does not has a clue what the instance name is gonna be. There you would use $cinst.columnname etc.

So all you need basically is that one row variable within your window or remote form.

Does that help?

Best regards,

Andreas

> Am 29.01.2018 um 21:27 schrieb Das Goravani <das at goravani.com>:
> 
> 
> I want to use Table Classes, but I’m wondering, if you put code in one for a Save method say from a Window, the $cinst has changed, so all your instance variables in the Window are not available correct ?  Isn’t that a problem ?  To me it is.  Please tell me if I’m right or if it works some other way, and if it is how I think, how do you get around it, I mean don’t you MISS the variables in the window, including the MAIN ROW ?  
> 
> As an aside, what are TM Objects ?  What does that stand for I mean, Doug mentioned them, and I’ve never heard of them. 
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 



Grüße,

Andreas




More information about the omnisdev-en mailing list