AW: Searching Schemas
Udo Sonnabend | WigaSoft AG
U.Sonnabend at wigasoft.ch
Wed Jan 27 12:42:44 UTC 2021
Hi, some comments
I recommend allways using $sendallref instead of $ref inside a $sendall() method. $ref can be ambiguous. $ref points to an element of the last applied method. See following example, which searches in aClassList with column name "className" pre filled. $ref point to a list line of aClassList:
Do $clib.$classes.$sendall(aClassList.$search($ref.className=$ref().$name,kTrue,kFalse,kTrue,kFalse))
better:
Do $clib.$classes.$sendall(aClassList.$search($ref.className=$sendallref().$name,kTrue,kFalse,kTrue,kFalse))
The double parenthesis () might be omitted in this case here (I didnt test). It is used to say Omnis to evaluate the reference to that point instead of returning the notation attribute name, here the name "$ref" or "$sendallref".
<<pick() executes all of its contained expressions before returning the indexed result,
Kellys Comment is correct.
Do pick(1,#1.$assign(7),#2.$assign(9))
Here Index 1 is allways used to assign #2, but #1 will be set to 7 too.
Regards, Udo.
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 Dawid Mocke <dawidmocke at gmail.com>
Gesendet: Mittwoch, 27. Januar 2021 12:36
An: OmnisDev List - English <omnisdev-en at lists.omnis-dev.com>
Betreff: Re: Searching Schemas
you guys are rock stars! WOW
On Wed, 27 Jan 2021 at 13:28, Kelly Burgess <kellyb at montana.com> wrote:
> >Now what does it mean?
>
> The Do performs the expression, and discards the result (no Returns used).
> The expression has two parts whose results are added together and ignored.
>
> Part 1 defines a local list to return with matching schema names
> > Do schemaList.$define(schemaName)
>
> Part 2 is a sendall to all the schemas in the current library. (Udo's
> latest example also processes multiple libraries)
> The sendall expression is in two parts whose results are added together
> and ignored.
>
> Part 1 assigns the name of the current schema to a local, for use by the
> sendall in Part 2.
> > +$clib.$schemas.$sendall(schemaName.$assign($sendallref.$name)
>
> Part 2 is a sendall to all the current schema's columns ($ref.$objs),
> telling them to add their schema's name (assigned by the previous
> expression) to the schemaList, IF their name matches the pColumnName passed
> in.
> >
> +$ref.$objs.$sendall(schemaList.$add(schemaName),$ref.$name=pColumnName))
>
> The $define and $assign expressions return true or 1. The $sendall
> expressions return the count of objects the sendall acted on. Those are
> the integers that are actually added together and ignored.
>
> Adding expression results is a way to do several things at once. Do
> name.$assign('Mike')+tea.$assign('Yes, please')+time.$assign(#T) Returns
> result --- will perform three assignments and return 3 in result, assuming
> all the $assigns return true.
>
> Just beware of using things like $assign() inside a pick() because pick()
> executes all of its contained expressions before returning the indexed
> result, and that can perform assignments or methods you didn't expect would
> happen.
>
> Kelly
>
>
> > Quit method schemaList
> >
> > Kelly
> >
> >> On Jan 26, 2021, at 2:37 PM, Kelly Burgess <kellyb at montana.com> wrote:
> >>
> >> Hi Dawid,
> >>
> >> Here's another approach - pass in pColumnName, get a list back. I'm
> still wondering if you could flatten all that into a one-liner with a
> $sendall...
> >>
> >> Kelly
> >>
> >>
> >> Do schemaList.$define(schemaName)
> >> Do $clib.$schemas.$first() Returns schemaRef
> >> While schemaRef
> >> Do schemaRef.$objs.$findname(pColumnName) Returns colRef
> >> If colRef
> >> Do schemaList.$add(schemaRef.$name)
> >> End If
> >> Do $clib.$schemas.$next(schemaRef) Returns schemaRef
> >> End While
> >> Quit method schemaList
> >>
> >
>
>
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
>
--
Dawid Mocke
This message (and any associated files) is intended only for the use of the
individual or entity to which it is addressed and may contain information
that is confidential, subject to copyright or constitutes a trade secret.
If you are not the intended recipient you are hereby notified that any
dissemination, copying or distribution of this message, or files associated
with this message, is strictly prohibited. If you have received this
message in error, please notify us immediately by replying to the message
and deleting it from your computer.
_____________________________________________________________
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