Re: External data storage question

2017-08-06 Thread John Baughman via 4D_Tech
Thought I had this resolved, but just discovered this not to be the case 
running Client/Server.

Apparently calling SET EXTERNAL DATA PATH and/or RELOAD EXTERNAL DATA in the 
trigger has no affect on the client. The client continues to reflect the 
version of the picture it loaded before replacing the picture in the field.

Even worse, if I quit and restart the client it continues to reflect the 
original, even if I log in as a different user. Quit and restart the server, 
however, and all is well. So, assuming this is a cache issue, in client Server 
the cache is on the server.

This is such a major bug, I think I must be doing something wrong. I created a 
small v16.1 test db to give to 4D TS. I am going to list below the steps to 
reproduce the problem in the test database in hopes that someone can point out 
the error in my way.

I sm currently at a loss as to how to force the client to forget the original 
image. 

Neither SET EXTERNAL DATA PATH or RELOAD EXTERNAL DATA can be run on the 
client. Everything has to be done on the server. The docs for RELOAD EXTERNAL 
DATA  say that on client one must reload the record "using the LOAD RECORD 
command for example”. This does not work. A record is reloaded in the normal 
process of going from the output form to the input form and moving between 
records in the output form before going to an input form. Just to be sure I 
unloaded and loaded the record manually and it made no difference. 

Keep in mind that the docs say that RELOAD EXTERNAL DATA is useful for  when a 
file in the external data storage folder is modified by a 3rd party app outside 
of 4D. It goes to imply that you only need to do that if the image is being 
displayed in a form.

Hoping someone can point out what I am doing wrong before Monday.

Thanks,

John

---
1. In the output form of the table double click a record which already has a 
picture in 4D and stored outside the database in a custom external data folder. 
Note: There is no problem creating new records. Only when the image is 
changed in an existing record.

2. In the input form load a different picture...

$doc=Select Document(…)
$path:=...
READ PICTURE FILE($path;[Patient Record]Image)

At this point I can see the newly uploaded image is being displayed in 
the field on the input form. 

3. Save the record. Trigger runs…

$imagePath;=… full path to the file in the external data folder
WRITE PICTURE FILE($imagePath;[Patient Record]Image)
SET EXTERNAL DATA PATH([Patient Record]Image;$imagePath) //not really 
necessary as the path did not change but this fixed the problem in stand alone
RELOAD EXTERNAL DATA([Patient Record]Image)  //this is the bigger 
hammer 

At this point I can visually verify that the file in the external data 
folder has changed. So the server does in fact get the updated picture in the 
picture field.

4. Open the record again and see that the original image is still displayed not 
the one that was just saved.

If the record is saved again now as is, the picture in the external 
data folder on the server will revert back to the original picture as step 3 
repeats with the original image.
If you poke the image programmatically, with Picture Size for example, 
the results will be for the original picture not the update.
-





 
> On Aug 3, 2017, at 1:21 PM, John Baughman via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> I recently changed storing a picture field outside the database from 
> automatic location to custom path name to file. Still working on getting it 
> ready for deployment.
> 
> I just noticed that if I open a form with the picture field displayed, then 
> change the picture to a different image, save it, then reopen the record, the 
> picture field continues to display the old picture. The picture file in the 
> storage folder reflects the new picture. I can actually watch it change as 
> the record is saved. The bad thing is if I save the record again the old 
> picture gets saved to the storage folder and the new picture is lost. If I 
> restart the database, without having reentered and saved again, the new 
> picture displays properly.
> 
> I know that I have to manage the creation and modification of the picture on 
> disk which I am doing, but I do not see anything that says I have to load the 
> picture from the storage folder. Am I missing something?
> 
> I also recently started working this db in v16 R4 beta so this may be a bug 
> in the beta? I do not really have an easy way to test this is an earlier 
> version of 4D.
> 
> John
> 
> 
> John Baughman
> Kailua, Hawaii
> (808) 262-0328
> john...@hawaii.rr.com
> 
> 
> 
> 
> 
> **
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: http://lists.4d.com/mailman/op

Re: External data storage question

2017-08-05 Thread Jody Bevan via 4D_Tech
Tim:

Thanks for posting this. I was totally unaware of this - probably started in my 
brief hiatus from programming. This is exactly what I was asking for a couple 
of weeks here. I will use this for my documentation now, and add in a few 
comments from time to time.

Jody Bevan
ARGUS Productions Inc.
Developer
Argus Productions Inc. 




> On Aug 4, 2017, at 1:52 PM, Timothy Penner via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> Hi David,
> 
>> Not sure how that happens, but I know that there's a way if you log in to 
>> something, somewhere, somehow...Or 4D could add something to the docs.
> 
> Do you mean this?
> 
> Tech Tip: The Comments feature for the Documentation Site .
> http://kb.4d.com/assetid=77724
> 
> -Tim

**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: External data storage question

2017-08-04 Thread John Baughman via 4D_Tech

On Aug 4, 2017, at 1:25 PM, Timothy Penner via 4D_Tech <4d_tech@lists.4d.com> 
wrote:

> For this specific issue, I wonder if the behavior is mentioned in the 
> references to "custom mode" in the 'External Data Storage' documentation here;
> http://livedoc.4d.com/4Dv15.4/help/Title/en/page3202.html 
> 
This behavior is not mentioned nor is there any discussion of how the data is 
cached. I read the blurb in the design ref while I was trying to debug the 
problem and again just now.

I stil think this might be a bug or at least unintended behavior (isn’t that 
the definition of a bug?). The documentation for Set External Data Path 
explicitly states that the command does not need to be reissued unless the path 
changes... “4D automatically maintains the link between the field of the record 
and the file on disk.”

I went ahead and added the following comment to livedoc. FYI, When you save the 
comment it says that the comment will be sent to the doc team after validation. 

> 
> While the docs say that once this command is executed you do not need to 
> execute the command again unless you update the path, if you modify the field 
> you must in fact issue this command again. Otherwise accessing the field 
> during  the current session will continue to return the original version of 
> the field, the version when it was first loaded, even though the file on disk 
> has been updated.
> 
> It appears that the field is being cached when first loaded and the cache is 
> not being updated when the field is modified and saved. 
> 
> Set External Data Path appears to be refreshing the cache with the newly 
> saved version of the field on disk even when the path has not changed.

John

John Baughman
Kailua, Hawaii
(808) 262-0328
john...@hawaii.rr.com





**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

RE: External data storage question

2017-08-04 Thread Timothy Penner via 4D_Tech
Hi,

> Would the livedoc version get the information into the docs for all supported 
> versions of the product?

I believe public comments carry over to all versions that article is used by.
For example, this comment made on August 2015 is visible for v14:
- http://livedoc.4d.com/4Dv14.6/help/Command/en/page717.html
and v16 (even though v16 did not exist when the comment was made):
- http://livedoc.4d.com/4Dv16.1/help/Command/en/page717.html

> Otherwise, what do you have to do - file a doc bug? Is that a thing at 4D?

Using the "send to doc team" option on the livedoc is essentially submitting a 
doc bug, you will be notifying the doc team of your comment without making the 
comment public. This is the process I follow when I encounter doc bugs or wish 
that something be added to the docs. Of course you can also contact 4D 
Technical Support, then the TSE will investigate the issue and help in 
determining if it is actually bug, a doc bug, or something else.

For this specific issue, I wonder if the behavior is mentioned in the 
references to "custom mode" in the 'External Data Storage' documentation here;
http://livedoc.4d.com/4Dv15.4/help/Title/en/page3202.html

-Tim



**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: External data storage question

2017-08-04 Thread Jeffrey Kain via 4D_Tech
Not sure - maybe Tim Penner knows for certain?

--
Jeffrey Kain
jeffrey.k...@gmail.com

> On Aug 4, 2017, at 3:57 PM, David Adams via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> Would the livedoc version get the information into the docs for all
> supported versions of the product? If so, it sounds like John could write
> it up. Otherwise, what do you have to do - file a doc bug? Is that a thing
> at 4D?

**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: External data storage question

2017-08-04 Thread David Adams via 4D_Tech
Would the livedoc version get the information into the docs for all
supported versions of the product? If so, it sounds like John could write
it up. Otherwise, what do you have to do - file a doc bug? Is that a thing
at 4D?
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: External data storage question

2017-08-04 Thread Jeffrey Kain via 4D_Tech
There's also the livedoc web site where partners can add comments to the 
documentation.

--
Jeffrey Kain
jeffrey.k...@gmail.com

> On Aug 4, 2017, at 3:45 PM, David Adams via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> Since this sounds like a potentially painful gotcha, it would be great if
> the docs were updated with some notes. Not sure how that happens, but I
> know that there's a way if you log in to something, somewhere, somehow...Or
> 4D could add something to the docs.

**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

RE: External data storage question

2017-08-04 Thread Timothy Penner via 4D_Tech
Hi David,

> Not sure how that happens, but I know that there's a way if you log in to 
> something, somewhere, somehow...Or 4D could add something to the docs.

Do you mean this?

Tech Tip: The Comments feature for the Documentation Site .
http://kb.4d.com/assetid=77724

-Tim





**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: External data storage question

2017-08-04 Thread David Adams via 4D_Tech
John,

It's great that you found this and tracked down the solution within a day,
with help from 4D.

Since this sounds like a potentially painful gotcha, it would be great if
the docs were updated with some notes. Not sure how that happens, but I
know that there's a way if you log in to something, somewhere, somehow...Or
4D could add something to the docs.
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: External data storage question

2017-08-04 Thread John Baughman via 4D_Tech
Kirk, 

In answering your question I discovered the problem was the command...

SET EXTERNAL DATA PATH([Patient Record]Image;$imagePath)

which apparently has to be called every time the picture is updated, not just 
when it is created even if the data path has not changed. Apparently SET 
EXTERNAL DATA PATH not only sets the path, but clears whatever cache 4D is 
using for the picture. I was calling SET EXTERNAL DATA PATH only if the path 
had changed or not been previously set.

So instead of…

WRITE PICTURE FILE($imagePath;[Patient Record]Image)
$currentImagePath:=Get external data path([Patient Record]Image)
 If ($currentImagePath#$imagePath)
SET EXTERNAL DATA PATH([Patient Record]Image;$imagePath)

End if 

I am calling…

WRITE PICTURE FILE($imagePath;[Patient Record]Image)
SET EXTERNAL DATA PATH([Patient Record]Image;$imagePath)

Works perfectly now.

I seem to remember now that when external data storage was first introduced 
there was some discussion or documentation that a feature of the new storage 
option was that 4D would cache pictures when loaded so that the next time the 
picture was needed it would not require a trip back to the file on the disk.


John

John Baughman
Kailua, Hawaii
(808) 262-0328
john...@hawaii.rr.com





**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: External data storage question

2017-08-04 Thread John Baughman via 4D_Tech
Kirk,

Correct me if I am wrong but, there is no choice with external data and 
client server as the external data folder is on the server machine. The 
managing of the external file has to be done on the server and a trigger is the 
logical place to do it as the external file has to be updated every time the 
image is modified or deleted.

John


> On Aug 4, 2017, at 4:32 AM, Kirk Brooks via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> ​Also keep in mind triggers always run on the server. So doing something
> like file manipulation is problematic and you can't rely on IP vars.
> 
> ​I'd move the file manipulation back to the form context. No idea if it
> will matter in this specific instance​ but it will be easier to get the
> user involved if something isn't working as expected.

John Baughman
Kailua, Hawaii
(808) 262-0328
john...@hawaii.rr.com





**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: External data storage question

2017-08-04 Thread Kirk Brooks via 4D_Tech
John,

On Fri, Aug 4, 2017 at 1:36 AM, John Baughman via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> 3. Click the save button. The table trigger’s on saving new record event
> does the following...
> a. Saves the picture to my documents folder with WRITE PICTURE FILE
> b. Sets the external data path with SET EXTERNAL DATA PATH


​I use triggers ​a lot and I avoid actions this involved in them. I view
triggers as a way to check the internal consistency of the record and
enforce data rules. At most I'll do things like apply timestamps and
similar. Triggers need to be very quick. Remember that a trigger is a
function and returning anything other than zero causes the record not to
save or delete.

​Also keep in mind triggers always run on the server. So doing something
like file manipulation is problematic and you can't rely on IP vars.

​I'd move the file manipulation back to the form context. No idea if it
will matter in this specific instance​ but it will be easier to get the
user involved if something isn't working as expected.


-- 
Kirk Brooks
San Francisco, CA
===

*The only thing necessary for the triumph of evil is for good men to do
nothing.*

*- Edmund Burke*
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: External data storage question

2017-08-04 Thread Keisuke Miyako via 4D_Tech
what happens if you do

[myTable]myPicture:=[myTable]myPicture*0

before you load the new jpg ?

your trigger is running, so the picture is touched for the database, we can 
assume that.
but the picture on form is not updated, so it sounds like a ref count issue for 
the form.

besides, you describe

> 6. Load a different jpg into the picture field.


the exact way in which you do that (command, drag and drop, etc) might hold the 
key to understanding.

> 2017/08/04 17:36、John Baughman via 4D_Tech <4d_tech@lists.4D.com> のメール:
> 6. Load a different jpg into the picture field.



**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

RE: External data storage question

2017-08-04 Thread Thomas Maul via 4D_Tech
> OK. I got my hand slapped for posting a bug to the beta forum.

I apologize for my bad English or being unclear in my answer.
I only wanted to help you to speed up the process, as getting solutions for 
issues is - in my experience - faster using the 4D Partner support directly, as 
the team is there to help you to understand the behavior and help to report the 
bug.
I wanted to help, that's only.
In no way the intention was to say don't do that.
Of course you can post directly, if you prefer that.

I'm sorry
Thomas Maul



**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: External data storage question

2017-08-04 Thread John Baughman via 4D_Tech
OK. I got my hand slapped for posting a bug to the beta forum. Somewhat miffed, 
I created a test db in v16.1 so I can either prove it to be a beta bug, or be 
able to talk to 4D TS in the morning with a version other than the beta. Well I 
am having the same problem in v16.1. So, yes I erred by posting a bug to the 
beta forum.

Anyway…. Anyone have any idea what I might be doing wrong? I do not see 
anything in the docs that says I need to do anything when opening the record in 
an input form. Outside of loading the record, I should not have to do anything 
to get the picture from the file on disk. Is not that the whole purpose of SET 
EXTERNAL DATA? If I procedurally load the record and check the picture size, 4D 
automatically loads the picture and I in fact get it’s size.

I have posted the steps I am taking to make this work. Maybe someone can point 
out what I am doing wrong before I make a fool of myself a second time when I 
call 4D TS in the morning. ;-)

Thanks,

John



Here is what I am doing in my test DB. I have a table with the picture field 
set to store the picture outside the data file. I have an output and input form 
created automatically by 4D in the user environment. The input form has the 
Image field and a button to load a picture into the picture field.

1. Create a new record, using New Record menu item in the user environment.

2. Load a jpg into the picture field.

3. Click the save button. The table trigger’s on saving new record event does 
the following...

a. Saves the picture to my documents folder with WRITE PICTURE FILE
b. Sets the external data path with SET EXTERNAL DATA PATH

4. Create a second record as above with a different jpg.

5. Return to the first record input form and verify the the original picture is 
still being displayed properly.

6. Load a different jpg into the picture field. Ok, the new picture is 
displayed properly. So far so good.

7. Click the save button. The table trigger's saving existing record event does 
the following…

a. Saves the new picture to my documents folder with WRITE PICTURE 
FILE. Same file name and path so the existing file on disk is updated.
b. Using Get External Data Path, check if the data path is still set 
properly if not SET EXTERNAL DATA PATH again… it is in fact always properly set.

8. Open the second record just to make sure that every thing from the first is 
cleared and a different record is loaded. Second looks good displaying it’s 
picture as expected.

9. Open the first record… The original picture is displayed!!!

10. Restart the database. Now the new picture displays as it should in the 
first record.








> On Aug 3, 2017, at 1:21 PM, John Baughman via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> I recently changed storing a picture field outside the database from 
> automatic location to custom path name to file. Still working on getting it 
> ready for deployment.
> 
> I just noticed that if I open a form with the picture field displayed, then 
> change the picture to a different image, save it, then reopen the record, the 
> picture field continues to display the old picture. The picture file in the 
> storage folder reflects the new picture. I can actually watch it change as 
> the record is saved. The bad thing is if I save the record again the old 
> picture gets saved to the storage folder and the new picture is lost. If I 
> restart the database, without having reentered and saved again, the new 
> picture displays properly.
> 
> I know that I have to manage the creation and modification of the picture on 
> disk which I am doing, but I do not see anything that says I have to load the 
> picture from the storage folder. Am I missing something?
> 
> I also recently started working this db in v16 R4 beta so this may be a bug 
> in the beta? I do not really have an easy way to test this is an earlier 
> version of 4D.
> 
> John
> 
> 
> John Baughman
> Kailua, Hawaii
> (808) 262-0328
> john...@hawaii.rr.com
> 
> 
> 
> 
> 
> **
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: http://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **

John Baughman
Kailua, Hawaii
(808) 262-0328
john...@hawaii.rr.com





**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: External data storage question

2017-08-03 Thread John Baughman via 4D_Tech
He David,

> Ouch. That definitely sounds like a bug to me, so I'd say file it wherever
> you're meant to. I think that's on the beta release forum in France.

Yep. I am nearly convinced that his is beta bug. I have already found a 
couple of other bugs and reported them. I will wait a bit to see if I hear back 
from any others on the NUG before I post this as a bug on the beta forum.

> I can't offer any real help because the only time I've used the external
> feature for lots of pictures, we went with letting 4D manage where to put
> the file. Then we backed it up into an explicit and sensible file hierarchy
> by hand. Worked fine. Made me feel safer...and made the files reusable. (I
> know I've mentioned this in the past, but there it is again.) Ask Tony or
> me if you've got questions.

Interestingly, I started this many many years ago, before 4D introduced 
external storage, storing externally with my own code. When 4D implemented the 
external data option, I switched to letting 4D handle it all automatically. 

The problem is that over time the external data folder has grown to 
over 200gb in size. The way that 4D implemented the automatic external storage 
is to include the external storage folder in a 4D backup. This has resulted in 
backups that take over 3.5 hours to complete. Unacceptable, in my opinion.

By switching to custom path to file, the backup now only takes about 2 
minutes. As an added benefit now all the files can be easily found manually in 
the finder on the drive. I have them stored by patient name/# and image series. 
4D’s automatic implementation of the storage results in an organization of the 
files in such a way that it is impossible to locate a file in the finder.

These images are also served to an iPad app. With automatic storage I 
have to load the record and save the picture out to a file that I can send to 
the iPad. I am looking at being able to serve the pictures to the iPad directly 
from the storage folder. In theory that should be noticeably faster.

> I'm on the mainland right now but not coming back through Hawaii. Are you
> at home or on the mainland?

Just got back last week.

John

John Baughman
Kailua, Hawaii
(808) 262-0328
john...@hawaii.rr.com





**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: External data storage question

2017-08-03 Thread John Baughman via 4D_Tech

> On Aug 3, 2017, at 1:45 PM, Jody Bevan via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> With what you have done now, how does 4D know the path of the document 
> (picture) that you saved.

Jody,

With custom pathname you use the command SET EXTERNAL DATA PATH and the 
path is saved with each record. In the table trigger for new and existing 
records…

CREATE FOLDER($imagePath;*)  //$image path is the full path to the picture file 
inside the external storage folder
WRITE PICTURE FILE($imagePath;[Patient Record]Image)  //saves the current 
picture in the field to the storage folder

$currentImagePath:=Get external data path([Patient Record]Image)

If ($currentImagePath#$imagePath)  //If this is a new record currentImagePath 
will be an empty string. This also handles the upgrade to the new custom 
storage when I deploy.
SET EXTERNAL DATA PATH([Patient Record]Image;$imagePath)

End if 

John


John Baughman
Kailua, Hawaii
(808) 262-0328
john...@hawaii.rr.com





**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: External data storage question

2017-08-03 Thread David Adams via 4D_Tech
John,

Ouch. That definitely sounds like a bug to me, so I'd say file it wherever
you're meant to. I think that's on the beta release forum in France.

I can't offer any real help because the only time I've used the external
feature for lots of pictures, we went with letting 4D manage where to put
the file. Then we backed it up into an explicit and sensible file hierarchy
by hand. Worked fine. Made me feel safer...and made the files reusable. (I
know I've mentioned this in the past, but there it is again.) Ask Tony or
me if you've got questions.

I'm on the mainland right now but not coming back through Hawaii. Are you
at home or on the mainland?
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: External data storage question

2017-08-03 Thread Jody Bevan via 4D_Tech
John:

We did this big time long before 4D permitted it autosaving the ‘picture’ 
outside of the data file that they looked after. Therefore we had to look after 
the saving, and when loading up the form we had to look after retrieving the 
‘picture’ as well. It sounds like you have done almost all the work an it 
should not take much code for you to be loading the pictures as well. With what 
you have done now, how does 4D know the path of the document (picture) that you 
saved. Is 4D caching the picture in memory so that if you reload it right away 
it uses what is cached instead of going and getting the file again? You can 
test this by shutting down your app in between.

Jody


Jody Bevan
ARGUS Productions Inc.
Developer

Argus Productions Inc. 




> On Aug 3, 2017, at 5:21 PM, John Baughman via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> I recently changed storing a picture field outside the database from 
> automatic location to custom path name to file. Still working on getting it 
> ready for deployment.
> 
> I just noticed that if I open a form with the picture field displayed, then 
> change the picture to a different image, save it, then reopen the record, the 
> picture field continues to display the old picture. The picture file in the 
> storage folder reflects the new picture. I can actually watch it change as 
> the record is saved. The bad thing is if I save the record again the old 
> picture gets saved to the storage folder and the new picture is lost. If I 
> restart the database, without having reentered and saved again, the new 
> picture displays properly.
> 
> I know that I have to manage the creation and modification of the picture on 
> disk which I am doing, but I do not see anything that says I have to load the 
> picture from the storage folder. Am I missing something?
> 
> I also recently started working this db in v16 R4 beta so this may be a bug 
> in the beta? I do not really have an easy way to test this is an earlier 
> version of 4D.
> 
> John
> 
> 
> John Baughman
> Kailua, Hawaii
> (808) 262-0328
> john...@hawaii.rr.com

**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

External data storage question

2017-08-03 Thread John Baughman via 4D_Tech
I recently changed storing a picture field outside the database from automatic 
location to custom path name to file. Still working on getting it ready for 
deployment.

I just noticed that if I open a form with the picture field displayed, then 
change the picture to a different image, save it, then reopen the record, the 
picture field continues to display the old picture. The picture file in the 
storage folder reflects the new picture. I can actually watch it change as the 
record is saved. The bad thing is if I save the record again the old picture 
gets saved to the storage folder and the new picture is lost. If I restart the 
database, without having reentered and saved again, the new picture displays 
properly.

I know that I have to manage the creation and modification of the picture on 
disk which I am doing, but I do not see anything that says I have to load the 
picture from the storage folder. Am I missing something?

I also recently started working this db in v16 R4 beta so this may be a bug in 
the beta? I do not really have an easy way to test this is an earlier version 
of 4D.

John


John Baughman
Kailua, Hawaii
(808) 262-0328
john...@hawaii.rr.com





**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**