References while sorting lists

Will Adkin will.adkin at lineal.co.uk
Thu Mar 14 10:30:51 EDT 2013


Thanks Michael,

I've realised there's a big hole in my knowledge in regard to the way Omnis manages references, I've discovered a bunch of times i've been using:

Set reference ref to myList

when it should have been 

Set reference ref to myList.$ref

I have been inadvertently setting references to strings all over the place thinking i was referencing a list, and most of the time they were working OK, but sometimes would be evaluated out of scope and I would not know why they broke...

I've been back through some of your older emails, most helpful!


Will Adkin, Software Development Manager, Lineal Software Solutions Ltd
Apple Reseller, Microsoft Partner, SQLWorks Business Partner
office phone: 01271 850550 | web: lineal.co.uk | email: will at lineal.co.uk

On 13 Mar 2013, at 18:18, Michael Monschau <michael at brainydata.co.uk> wrote:

> Hi Will,
> 
> I am not sure I understand your question but I have a go
> 
> When you do
> 
> Set reference ref to [$cfield.$dataname]
> 
> Omnis expects the contents of the square brackets to contain a notation string it can create a reference from. However $cfield.$dataname will just return a variable name which is in it self is not valid notation. However when you do
> 
> Set reference ref to [$cfield.$dataname].$ref
> 
> what Omnis receives is something like ivMyVar.$ref which is a valid notation string and Omnis knows what to do with it.
> 
> When you have to pass an item reference as a parameter to a notation function, the same rules apply as they do for the Set reference command.
> 
> Regards,
> Michael
> 
> Michael Monschau (Director)
> Brainy Data Limited
> 
> Reply To: michael at brainydata.co.uk
> Phone: +44 (0)870 474 0708
> Web: www.brainydata.co.uk the home of Omnis Components and Developer Services
> 
> 
> 
> 
> 
> 
> On 13 Mar 2013, at 12:46, Will Adkin wrote:
> 
>> 
>> Hi List,
>> 
>> Trying to get my head around this omnis behaviour
>> 
>> I have the following generic line of code that will sort a headed list on evHeaderClick
>> 
>> Do $ctask.oPrefs.$sortHeadedList($cfield,[$cfield.$dataname].$ref,pColumnNumber,iSortAscending)
>> 
>> I receive the second parameter as a field ref and all works OK, but if i change the second param to [$cfield.$dataname] and receive it as a field ref it no longer works, why is this? the square brackets do not appear to have been evaluated and rather than referencing the list it seems to be referencing the string: "[$cfield.$dataname]"
>> 
>> Also, i have been trying to do the same thing without needing to send in a reference to the list variable - using only a reference to the headed list field I thought I should have been able to get a reference to the list data it was using, I tried to set a reference to the $contents of the field so i could sort that directly, but while I can calculate $contents into a different list i don't appear to be able to set a reference to it... 
>> 
>> Maybe I am going about this the wrong way? 
>> 
>> Will
>> 
>> Will Adkin, Software Development Manager, Lineal Software Solutions Ltd
>> Apple Reseller, Microsoft Partner, SQLWorks Business Partner
>> office phone: 01271 850550 | web: lineal.co.uk | email: will at lineal.co.uk
>> 
>> _____________________________________________________________
>> Manage your list subscriptions at http://lists.omnis-dev.com
> 
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com




More information about the omnisdev-en mailing list