File Format fields order

Doug Easterbrook doug at artsman.com
Tue Sep 28 19:09:53 UTC 2021


hi Greg.

a word on MOFF’s….     which we use a lot .. but in this context.

MOFF’s
1) can can used for code completion when typing variable names
2) can go in query classes — as fake variables.


we call them gVars for two reasons
1) they are global
2) they start with ‘g’ for easy identification.

for example, we might call one of the gIcon (character)

and in a query class that is used to fill a list based on a table…. we might see the following for a ‘customer’ list which is defined on this query

gIcon
C_FIRST_NAME
C_LAST_NAME
etc


so, when you do something like

do list.$definefromsqlClass(‘customerList’)
do list.$getAllData.     (we have a function that does this)


it makes sql that looks like

select gIcon,C_FIRST_NAME,C_LAST_NAME from customerfile where ….


of course its going to fail because gIcon is not a field defined in a database.   and herein comes the cool trick that I’ve talked about at Euromnis


Before we run the SQL, we have a function in the table class that is called. $getReplacementSelectNames

it might do this

Parameter  pSelectVars

calculate query as ‘   (select GetIconFunctionForCustomers(customerfile) as gIcons’
calculare pSelectVars as replace(‘gIcons’,query,pSelectNames)


the query now becomes

select (select GetIconFunctionForCustomers(customerfile) as gIcons,C_FIRST_NAME,C_LAST_NAME from customerfile where ….




and that, because it executes on the server, is super fast.   We never play with lists as they are loading and do calculations on fields ….   never — it s too slow in omnis to unpack and pack a list for each line.



and the MOFF variable  gIcons is now in a list.


it all works very neatly with omnis — since omnis things it is any other variable from the database.



and we stick style() icons into the gIcon to display icons at the left side of each row.





the concept..
1) declare global variables that are not part of the database
2) substitute functions, sub selects, or any valid sql for the variable to pull any data from anywhere
3) display it in a list.
4) reference it as list.gVariable
5) get code completion when referring to gVariable
6) have a definition for the variable so that when you look it up using f9 or hovering over the variable, it describes what its purpose is.
7) works when using foreground or background threads for sql — interchangeably.


and there are more reasons we do it, but those are the basics.    it sure speeds up SQL… and it makes background loads work great.



but again, that is another beer conversation.  which I can’t wait to have again one day.




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

> On September 28, 2021, at 11:49 AM, Grzegorz (Greg) Pasternak <gpasternak at cogeco.ca> wrote:
> 
> 
> 
>> On Sep 28, 2021, at 12:42 PM, Das Goravani <goravanis at gmail.com> wrote:
>> 
>> 
>>> 
>>> Rudolf Bargholz
> 
>> It’s probably faster than repeat loop assigning values from Schema defined row to MOFF fields.. just assign row then load cols to fill the CRB
>>> 
> 
> A comment about CRB, while it may be convenient to use at times I prefer to stay away from it, instead I prefer to work with vars of type row with relevant scope.  I dislike CRB because it is global and I never trust its state.  I prefer to avoid MOFF for the same reason.
> 
> Greg
> 
> 
> 
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com



More information about the omnisdev-en mailing list