Hi Jeremy,

Thanks! The fog is clearing…

Over-thinking is my speciality!

Appreciate,
John…


> I think you have it: it is indeed magic!
> 
> The method called, via CALL FORM, by the worker has full access to all the 
> form’s variables (in that way, it’s just like a form method). Your worker 
> process can pass it, for example in an object, the values to be added to the 
> listbox’s arrays. It adds them and the box will just update. It’s very easy 
> to overthink it: give it a go and I suspect you’ll be amazed at how 
> straightforward it proves to be.
> 
> Jeremy
> 
>> On Mar 9, 2020, at 10:28 AM, John J Foster <[email protected]> wrote:
>> 
>> Hi Peter,
>> 
>> That makes sense and I beginning to get a sense/visualize it.
>> 
>> This stuff is like magic in comparison to the older approach.
>> 
>> Thank you Peter!!!
>> 
>> John...
>> 
>>> On Mar 9, 2020, at 10:25 AM, Peter Bozek <[email protected] 
>>> <mailto:[email protected]>> wrote:
>>> 
>>> 
>>> 
>>> On Mon, Mar 9, 2020 at 5:52 PM John J Foster via 4D_Tech 
>>> <[email protected] <mailto:[email protected]>> wrote:
>>> Hi Peter,
>>> 
>>> I haven’t used CALL WORKED/CALL FORM yet. I’ve seen some tutorials by John 
>>> Baughman which made sense when I watched them. But a different context I 
>>> think.
>>> 
>>> 
>>> Idea is as follows: you cannot share memory (variables...) between worker 
>>> and another process. But you can pass parameters to method running in 
>>> another process.
>>> 
>>> So you need one method, that calculated content of displayed array, and 
>>> packs the calculated values into object with, say, OB Set array, and this 
>>> method runs in the worker, and another method that receives the object as a 
>>> parameter, extracts the values from objects and inserts them into arrays 
>>> displayed by LB.
>>> 
>>> CALL WORKER is called with first method as second parameter and runs inside 
>>> worker, second method is passed as a second parameter to  CALL FORM and 
>>> runs in the process of the form.
>>> 
>>> I guess that’s why my brain is not seeing this clearly yet.
>>> 
>>> My search form has a bunch of variables including a date range, a source 
>>> and target arrays that it needs to loop through and a mother array list. 
>>> The search will go something like:
>>> 
>>> Loop through Source array
>>> for this Source{index}...
>>>    Loop through Target array
>>>    for this Target{index}...
>>>       Loop through Aspect array
>>>       for this Aspect{index}…
>>>          Call this search method for tis date range…
>>>          As rows are found build the listbox   <--
>>> 
>>> instead of this line, you would, after, say, each N lines, pack the data 
>>> into object and call CALL FORM 
>>> 
>>> Another method (2nd parameter of CALL FORM will unpack data and build 
>>> listbox.
>>> 
>>>  Pseudocode would be:
>>> 
>>> Method_Worker:
>>> receives window reference in $1
>>> loop through data
>>>   each 50 records
>>>     calculate values
>>>   end each
>>>   pack last 50 lines into object
>>>   CALL FORM(window reference;"Method_Form";object)
>>> end loop
>>> 
>>> Method_Form
>>> receives object in $1
>>> extract object into arrays
>>> loop through values in arrays
>>>   insert values from passed arrays into listbox
>>> end loop
>>> 
>>> then form in On load, calls
>>> CALL WORKER("worker name;"Method_Worker";window reference of itself)
>>> 
>>> Form method does not call Method_Form or do anything.
>>> 
>>> HTH,
>>> 
>>> Peter Bozek
>> 
> 
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to