Resolution of Search List Syntax

Bastiaan Olij Bastiaan.Olij at instinctsystems.com.au
Sun Jun 2 20:30:50 EDT 2019


Hey Das,


$sendallref is a special helper that references the item sendall is looping over.


For instance, take the following code:
Do lvMyList.$cols.$add("Fieldname",kCharacter,kSimpleChar,250)
Do $cinst.$objs.$sendall(lvMyList.$add($ref.$name))


On face value you would think this will add a row to my list for each object in my window specifying its name. The problem is that inside of $add, $ref already has meaning so what this line of code ends up doing is adding the name of my list to my list for each object of the window. I end up with a list filled with "lvMyList" repeated over and over again.


The problem here is that we're nesting commands and when you nest commands the use of $ref can change.


The fix is to change the code to:
Do lvMyList.$cols.$add("Fieldname",kCharacter,kSimpleChar,250)

Do $cinst.$objs.$sendall(lvMyList.$add($sendallref.$name))


In this line of code $sendallref always points to the item $sendall is iterating over, in this case the fields of my window, and I get the name of the field added to my list.


(and yes, I know I can obtain the same list with $appendlist or $makelist, but this is an easy example of where nesting with $sendall requires the use of $sendallref)

Kindest Regards,


Bastiaan Olij
Head of development - Instinct Systems: The JobBag People
Ground Floor, 48 Chandos Street
St Leonards NSW 2065
Australia


Phone: +61 2 8115 8000
Direct: +61 2 8115 8007
Mobile: +61 4 321 44833
bastiaan.olij at instinctsystems.com.au
http://www.jobbag.com



 From:   Das Goravani <das at Goravani.com> 
 To:   Bastiaan Olij <Bastiaan.Olij at instinctsystems.com.au>, OmnisDev List - English <omnisdev-en at lists.omnis-dev.com> 
 Sent:   6/3/2019 9:44 AM 
 Subject:   Re: Resolution of Search List Syntax 

 
What is the diff between $ref and “sendallref” which I’ve never heard of.  
 
I do a $sendall in my app. It’s a feature I’m very happy with. You have a number of open windows, and on them is variously placed things which are date sensitive, be it a list of dates, of events, or a chart which is drawn for a date, and somewhere you click a date, and lets say you want all those date lists to hi light the closest line to the date clicked..the chart to redraw because of the date clicked..sendall makes it easy to alert every window that something has happened. In my case, I send the phrase “$Align” in the enclosure, and that is a method that the windows have in them if they have a date list or something…to Align…and I write the Align methods for each window, and voila, you click a date somewhere, it calls a procedure that does the send all, and everything dances, very object oriented…love it 
 
Coming back a day later in my case meant I set up my test data more carefully, then it started working, because I could see that it was…duh…if you have a bad test bed you’re gonna think things are failing when they’re not necessarily.  
 
I just got an idea about $ref doing this search for a list…someone said dont use the list name, use $ref, and it instantly made sense, and now I love the idea of that standing for the thing you’re addressing, that’s simple but cool.  Sometimes I see $ref used in ways I dont yet understand, and I’ve used it to effect sometimes in ways I dont understand, but it made it work !  
 
Today I finished up a list drill down set of methods, feature. There is a list, and there are two data items on a line, double click, and it becomes three, and four, and five, as you double click…it’s levels of a date line, each level is more detail, this has been very cool, it’s cool to watch 
 
Now for a little taste of Oregon: For those who have read this far: Oregon is a funny state, being both a liberal, and conservative, simultaneously, due to it’s variegated population. Here’s the bomb of today: Machine Guns, are LEGAL to own and operate in Oregon.  So My Neighbor, has one, and has a makeshift firing range in his yard, and on the weekends like today, just rarely, since bullets are expensive, and machine guns go through ‘em like crazy, he gets out there and lets off a voly of rounds, brrrrrrrrrrrrrrrr, that’s the sound, it’s like a fart, I hate it, but that’s the countryside in Oregon for ya, being Californian native I can’t believe it. I’m coding in peace and then brrrrrrrrrrrrrrrrrrrrrrr. Uh ha ha ha. Life.  
 
> On Jun 2, 2019, at 4:25 PM, Bastiaan Olij <Bastiaan.Olij at instinctsystems.com.au> wrote: 
>  
> Hey Das, 
>  
>  
> I have often found that walking away from a problem and returning to it some hours or a day later, is exactly what helps resolve it. Often you think you've tried a solution only to find out the solution was the right one but only after you did a few other things.  
>  
>  
> Glad to hear you've gotten this sorted. I personally LOVE LOVE LOVE functions like $search and $sendall. It takes a little getting used to using $ref or $sendallref and knowing the difference between them but they are so powerful.  
>  
>  
> As a general rule I try and avoid # variables.  
>  
> Kindest Regards, 
>  
>  
> Bastiaan Olij 
> Head of development - Instinct Systems: The JobBag People 
> Ground Floor, 48 Chandos Street 
> St Leonards NSW 2065 
> Australia 
>  
>  
> Phone: +61 2 8115 8000 
> Direct: +61 2 8115 8007 
> Mobile: +61 4 321 44833 
> bastiaan.olij at instinctsystems.com.au 
> http://www.jobbag.com 
>  
>  
>  
> From:   Das Goravani <das at Goravani.com>  
> To:   OmnisDev List - English <omnisdev-en at lists.omnis-dev.com>  
> Sent:   6/1/2019 9:39 AM  
> Subject:   Resolution of Search List Syntax  
>  
>  
> This line works beautifully.  
>  
> Do ivFinalList.$search(tvDragDate=dat($ref.LSFDT1)|tvDragDate<dat($ref.[$ref.$line+1].LSFDT1),1,0,1,1) 
>  
> The keys are a $ref in front of $line in the second clause, and dat() functions around the date time field LSFDT1.  
>  
> I think yesterdays’s problems were my fault of not having my test data set up correctly as today everything ran much more smoothly as I worked on this.  
>  
>  
> _____________________________________________________________ 
> 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