has anybody ever set a reference to 'unset_reference'

Doug Easterbrook doug at artsman.com
Mon Mar 22 21:27:30 UTC 2021


hi Udo.

interesting idea. by abstracting what you said, I could fake it by creating a task variable item ref called ‘unsetreference’. — basically make my own constant.

and then  

set reference     myItemRef to  UnsetReference

then I could test

if myItemRef=unsetreference
  # it is not set
else
 # it is set
end if




what caused the root of my problem is that we have a function called $assignParameter (field,value) which pulls values out of a ‘row’ field called parameter. 

we have this as we have developed the habit of passing around a row field containing name value pairs between windows, functions,, you name it.   itws easy to take a column out of row field and easy to add another one in.

in effect, you only ever need to pass the row variable around and you get ‘unlimited’ parameters that are independent of order … with only having one actual parameter.

We use TMObjs to make rows easily and to automatically determine the variable type based on contents, without having to define the variables.

assuming that parameter is a rowvariable

eg

calc parameter as tmObjs.$makeParamRow(‘Age’,agevar,’window’,iWindowref,’Name’,firstNameVar,’object’,omnisOjectRef)

(equivalent code in omnis)
do parameter.$define(Age,window,name)
calculate parameter.age as agevar
set item ref parameter.windowref to iWindowref
calculate parameter.Name as firstNameVar
etc


in omnis, if you want to add a column, you have to
do parameter.$cols.$add(Anothervar)
calculate parameter.Anothervar as ’somevalue’


using tmobjs, we just append more parameters to the end of the row eg
parameter as tmObjs.$makeParamRow(parameter,’Anothervar’,’somevalue’)


so where am I going with all this making of rows and using them as parameters, passing them around as name value pairs…


assume, above, that iParameter was passed into a window and we wanted to see what parameters we were given.    This is where the $assignParameter comes in.  we have things like

do $cinst.$assignParameter(‘Age’,iAgeVar)
do $cinst.$assignParameter(‘WindowRef’,iWindowRef)



and in assign parameter, we have
param1->   FieldName character
param2->   Value  fieldReference


and the code kind of looks like this

if iParameter.$cols.$findname(fieldname)
 # field name exists, lets get its value
  if iParameter.[FieldName].$type = klItemref
    set reference iParameter.[FieldName] as iParameter.Fieldname   (to gets its value :) )
 else
   calculate iParameter.[FieldName] as iParameter.Fieldname
 end if
end if



the issue, from a programming perspective is that you want to know the $type of the fieldName and the $type of the value to k ow if you want to use 

set. reference.   or 

calculate


and since the value we are assigning to is field reference ,…. I need to know if I’m assigning an unset reference or not.



thats the gist of the problem…. 


I could use a constant, but I’d really rather set the reference back to being unset.





The above kind of explains where the problem came from and why I need it to be unset…


it also explains a very handy way of passing parameters around windows and methods and etc….   which we’ve found invaluable to keep our code so that parameters are order independent and we don’t need to supply them all.



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

> On March 22, 2021, at 1:48 PM, Udo Sonnabend | WigaSoft AG <U.Sonnabend at wigasoft.ch> wrote:
> 
> Hi Doug
> 
> How do you test procedural for that value ?
> 
> I was'nt successfulwith:
> 
> If lRef='Unset reference'
> or
> If lRef.$name='Unset reference'
> ....
> 
> If you have a successful if-command which evaluate to 'Unset reference', you could try:
> Set reference lRef to 'Unset reference'
> 
> Regards, u.
> 
> 
> 
> WigaSoft AG
> Udo Sonnabend
> Entwickler
> 
> Oberstrasse 222 | Postfach 51 | CH-9014 St. Gallen
> Telefon +41 71 274 51 31 | www.wigasoft.ch<http://www.wigasoft.ch/> | U.Sonnabend at wigasoft.ch<mailto:U.Sonnabend at wigasoft.ch>
> 
> 
> Diese Mitteilung kann persönliche, vertrauliche oder rechtlich geschützte Informationen enthalten und ist nur für die Verwendung durch den beabsichtigten Empfänger bestimmt. Auf Vertraulichkeit oder Rechte wird aufgrund von Fehlübertragungen nicht verzichtet. Wenn Sie nicht der beabsichtigte Empfänger dieser Mitteilung sind, dürfen Sie diese in keiner Form verwenden, verbreiten oder kopieren. Haben Sie diese Mitteilung irrtümlich erhalten, dann löschen Sie diese und allfällige Kopien und benachrichtigen Sie bitte unverzüglich den Absender – besten Dank.
> 
> P Bitte denken Sie an die Umwelt, bevor Sie dieses Mail drucken. Think before print!
> 
> ________________________________
> Von: omnisdev-en <omnisdev-en-bounces at lists.omnis-dev.com> im Auftrag von Doug Easterbrook <doug at artsman.com>
> Gesendet: Montag, 22. März 2021 18:55
> An: OmnisDev List - English <omnisdev-en at lists.omnis-dev.com>
> Betreff: Re: has anybody ever set a reference to 'unset_reference'
> 
> hi Nick,
> 
> I can’t do that in a locked library or if there are other variables referring to it.
> 
> you can set booleans to null, integers to zero (or null)… dates to null or empty.
> 
> there is just no way to set an item ref to be ‘unset’.
> 
> 
> I’ve reported to omnis and raised an enhancement to allow it.
> 
> 
> 
> 
> Doug Easterbrook
> Arts Management Systems Ltd.
> mailto:doug at artsman.com
> http://www.artsman.com
> Phone (403) 650-1978
> 
>> On March 22, 2021, at 8:55 AM, Nick Renders <omnis1 at arcict.com> wrote:
>> 
>> Hi Doug,
>> 
>> Have you tried deleting the variable and recreating it?
>> It's a convoluted way, but in theory it should result in an unset reference.
>> 
>> Nick
>> 
>> 
>> On 20 Mar 2021, at 21:54, Doug Easterbrook wrote:
>> 
>>> hi all.
>>> 
>>> if you declare a variable and an itemref an never set it to anything, it has a nice value of being an 'unset reference’
>>> 
>>> 
>>> if, in your code, you actually set the itemref to anything like ($cobj, $cwind, $cfield, anything) using
>>> 
>>> set reference MyItemRef to $cfield
>>> 
>>> then it is nicely set.
>>> 
>>> 
>>> 
>>> the question is … has anybody figured out how to make it an unset_reference again?
>>> 
>>> 
>>> you can set the reference to ‘’ or #null, but that does not leave the item reference as unset.
>>> 
>>> eg
>>> 
>>> set reference MyItemRef to ‘’    or
>>> set reference MyItemRef to #NULL or
>>> do myItemRef.$assign()
>>> 
>>> your reference cannot be made ‘unset’
>>> 
>>> 
>>> anybody done this?? or have a hint?
>>> 
>>> 
>>> Doug Easterbrook
>>> Arts Management Systems Ltd.
>>> mailto:doug at artsman.com
>>> http://www.artsman.com
>>> Phone (403) 650-1978
>>> 
>>> _____________________________________________________________
>>> Manage your list subscriptions at http://lists.omnis-dev.com
>>> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
>> _____________________________________________________________
>> Manage your list subscriptions at http://lists.omnis-dev.com
>> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
> 
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
> _____________________________________________________________
> 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