has anybody ever set a reference to 'unset_reference'

Dan Ridinger dlr at futurechalk.com
Tue Mar 23 00:05:18 UTC 2021


Hello Doug

The unset reference is an error message only it seems. The value is actually empty for comparison purpose. This snippet will set the item reference back to empty after being set.

kiRefItem is a variable that is defined as item reference and is never set, works as a constant as you mentioned.

If isclear(iObjectRef)
# object is empty
Else
# object has a value
End If
Set reference iObjectRef to $clib
Set reference iObjectRef to kiRefItem (‘’  works also)
If isclear(iObjectRef)
# object is empty
Else
# object has a value
End If

The iObjectRef test as empty coming in  and after setting it to kiRefItem it also compares to empty

In the variable value window the value of iObjectRef shows nothing. Once set it shows the $root… Once set to kiRefItem iObjectRef show nothing again



Value. After setting iObjectRef to the kiRefItem it show blank again as if it was not set.

The only way I found to make the iObjectRef to become unset is to delete the variable and then recreate it. 

Thought I would as my two bits.

Sorry I couldn’t provide a solution. It was fun to try though.


Dan Ridinger



> On Mar 20, 2021, at 1:54 PM, Doug Easterbrook <doug at artsman.com> 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 



More information about the omnisdev-en mailing list