Searching Schemas
Mike Matthews - Omnis
omnis at lineal.co.uk
Wed Jan 27 11:45:42 UTC 2021
10/10, full marks to Mr Kelly & Mr Udo.
You are now Teacher’s Pet; Mrs Matthews is a teacher by the way, and she likes Apples :)
Mike
On 27 Jan 2021, at 11:28, Kelly Burgess <kellyb at montana.com<mailto: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<mailto: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 https://linkprotect.cudasvc.com/url?a=http%3a%2f%2flists.omnis-dev.com&c=E,1,YL-zFxHK9Gbwc-hOCV69jWLcn-eikhKKAQLIJ19H2EuMd32Q9LSJEAhrSNScbGsBg3d5oB5Fv5lsxkHNevq4CSmXcbxxea6XCQp0fWGA1Lan1pftyw,,&typo=1
Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
More information about the omnisdev-en
mailing list