Jim,
Miyako's post is a concise primer for modern 4D forms. Being able to pass a
pointer to a dynamic form variable to another process, even one running on
the server, is a great feature and one I've been using for several years.
Let me share a couple of things I've learned doing this:

- avoid using the pointer in methods
Create a local variable, dereference the pointer to it if you need to, do
the calculations and then write the local var back to the pointer. This is
especially helpful if you are passing pointers to arrays. Dereferencing
pointers is very fast but it's noticeable. Plus it's easier to debug a
method using local vars instead of pointers.

$localVar:=$1->

--  do stuff --

$1->:=$localVar

- use objects

I use Execute on server a lot for collecting information for forms. I have
really come to appreciate using a c-object as the container in these cases
(really almost all cases). You can put anything into it (blobs are clunky).
Object operations are very fast and you only have one pointer to worry
about. Even moving arrays is fast and easy - easier than packing and
unpacking blobs. And again debugging is easier because you are working with
local vars on both sides of the transfer.

I work almost exclusively on 4D server so I'm always looking at these
questions from that perspective. But these work just as well in single
user.


Another idea for handling the "
certain actions will query a service, which could take up to a few seconds
" problem.
If this is data that is always based on the same criteria (eg. a
'scoreboard' listing of salesreps and month to moment sales) start a
background server process to periodically assemble this data and hold it in
variables. Clients simply use variable to variable to read those variables
for display.

If the data is specific to the user or record displayed you could do the
same thing on the client machine.

In both cases if you don't like variable to variable (and there are good
reasons not to), or are using a Worker, the output could be written to a
table ( [IP_msgs]) and the form reads the messages. This would allow a user
to click a button as much as they like and not hork things up since it
would simply read whatever the message is.
-- 
Kirk Brooks
San Francisco, CA
=======================

*We go vote - they go home*
**********************************************************************
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