Hi Chris,

On Fri, Apr 24, 2020 at 1:54 AM Chris Belanger via 4D_Tech <
[email protected]> wrote:

> • Loading a system document into a BLOB, then using BASE64 ENCODE to store
> it in a TEXT field;

Out of curiosity why not simply blob the document into a blob field? Even
if it's a temporary record just for this purpose. The advantage is the
blobing action takes place on the client and when the record is saved the
data actually moves to the server. Then the operation of saving the blob to
disk can be put into a different method and executed on the server. I found
this gave better reliability (this was happening with 4D connected over the
internet) because I could check where the data actually was at each step
along the way and better resiliency because I could continue a long
operation if it was interrupted.

• the TRIGGER method (running on 4D server) unpacks it and creates /
> updates the files in its ‘Library’ directory on disk.
>
Following from above doing that much heavy processing in a trigger seemed
fragile.


> Now I need to be able to retrieve the contents of these files for 4D
> [Client].
> I can display the files in a Web Area

** But I am looking for a simple way to get 4D Server to ’send’ the data to
> the CLIENT (4D) upon request.
>
So do you want to initiate the transfer from the web page or from the
Client?
From the Client it's pretty straightforward :

Select the doc and fire some method that executes on the server

This server-side method gets the document and a blob and returns it to the
Client as $0

Back on the client you manage saving it to the selected location on disk


Depending on the size and number of the documents I would think about using
temp records: blob into the record on the server and return a list of said
records to the client. The client gets them, writes the blob to disk and
deletes them. Better ability to resume/continue of dropped connections are
an issue.

 Do I have to use Workers, or Stored Procedures, or something?
>
Maybe. If lots of users are doing this a lot of the time it might be
beneficial. But that's more of a tactical question. Whatever code they
would be running is going to involve the decisions you make on the above
tasks. I have used stored methods for this sort of thing (workers didn't
exist yet). The stored methods work well when you put the documents in
records.

-- 
Kirk Brooks
San Francisco, CA
======================
**********************************************************************
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