doug at artsman.com
Thu Jul 28 15:43:24 UTC 2022
Like Ben, ee pass rows around as parameters.
whether you want to use the calculate before you pass back the row, or not, is a matter of your personal practice.
i.e. is this better
Calculate lRow as row(lVar1,lVar2,lNum1,lNum2)
Quit method lRow
Quit method row(lVar1,lVar2,lNum1,lNum2)
no, not really.
this is an ancillary thought. One things omnis doesn’t provide for you is the ability to create rows with dynamic content.
the input to a method might be a row with Var1,Var2 and perhaps other variables, that you might not know about)
you might want to pass back Var1,Var2 (and perhaps other variables) PLUS two new variables (or replace existing variables in the row)
the theory is that parameters can be passed down the call sequence. (its done often in python.
if such is the case - yopu want to add your return variables to an existing row, the the FIRST option is better.
if condition 1 is true then
Calculate lRow as row(lVar1,lVar2,lNum1,lNum2,lDate1,ldate2)
Quit method lRow
now, thats a lot of conditional stuff to make dynamic rows…...
for those of you who use TMObjs (freely available external) to construct rows, you can create rows dynamically by concatenating two rows and/or adding variables to an existing row. makes the above easier
calculate lRow as TMobjs.$makeParamRow(‘lVar',lVar2,’lNum1’,lNum2)
if condition 1 then
# append variables to an existing row
calculate lRow as TMobjs.$makeParamRow(lrow,'lDate1',ldate2)
that kind of thing.
since we do that a fair bit to pass a row of parameters onwards, we prefer the first approach.
Arts Management Systems Ltd.
mailto:doug at artsman.com
Phone (403) 650-1978
> On Jul 28, 2022, at 4:53 AM, Martin Obongita via omnisdev-en <omnisdev-en at lists.omnis-dev.com> wrote:
> Hi ALL,
> I have another issue similar to global variables and best practice.I see programmers store variables in a row before passing them over.
> For example:
> Calculate lRow as row(lVar1,lVar2,lNum1,lNum2)
> Quit method lRow
> Why not simply pass the variables as a row this way?Quit method row(lVar1,lVar2,LlNum1,lNumb2)
> I hope I am not jamming the list with unnecessary stuff.
> Kind regards,Martin Obongita.
> 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