I had noted a problem with 4D's MOVE DOCUMENT command in 2001 (at the time
using it in 4D, not in Active4D):
Suppose I want to move file "mydoc0695.jpg" from folder "tmp" to folder
"docs". However, in folder "docs" there is already a document named
"mydoc0695.jpg". So I set the second parameter of the MOVE DOCUMENT command
to rename the document being moved to "mydoc0695_1.jpg"
So the document from "Import" folder is supposed to get moved into "docs"
folder, with a new name. But what happens instead is that the document
already there named "mydoc0695.jpg" gets renamed to "mydoc0695_1.jpg", and
the document that was supposed to get moved stays in its original location.
Those are the circumstances where I had a problem with the MOVE DOCUMENT
command.
I think my workaround was to use the MOVE DOCUMENT command once to rename
the document at its original location, then use MOVE DOCUMENT a second time
to move the document to the other folder.
Best Regards,
Tim Tonooka
----- Original Message -----
From: "Steve Alex" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, September 13, 2006 2:43 AM
Subject: [Active4d-dev] Move Document bug?
I don't know if I discovered a bug, or I just don't fully understand
system documents commands. The Move Document(src;dest) command is failing
to move and rename a document under some circumstances - I just don't know
exactly what those circumstances are.
I gave up on "file upload" as a technique to get documents to the
database. I opted for an email solution. Without going into a lot of
detail - a mailto link is generated with enough information to identify
the document that should be enclosed (mainly PDFs). A 4D method is called
from Active4D that uses Internet Commands to check the mail and download
the mail and any attachments to a "tmp" director in the web root. The
method then figures out what it has, moves and possibly renames the
document to a "docs" folder that is just outside the web root. The "docs"
folder is a safe documents folder and is used by two different virtual
hosts. In my case, the document is moved from the tmp directory to the
correct sub directory in docs, but it is not renamed. To take my
circumstances out of the picture, I created a test case method in the
Active4D demo database.
$fromfile := "/Macintosh HD/Users/salex/Desktop/Demo/web/tmp/foo.txt"
$toFile := "/Macintosh HD/Users/salex/Desktop/Demo/docs/eforms/200608/
foobar.txt"
$af := test path name($fromFile)
$at := test path name($toFile)
if($at = 1) // file exits, delete it and create new version
delete document($toFile)
end if
move document($fromFile;$toFile)
$atx := test path name($toFile)
a4d.debug.dump locals
In the Demo, I set up the safe documents folder, created the sub
directory structure, and allowed the test method to be executed outside
of fusebox. When running this, "foo.txt" gets moved, but does not get
renamed to "foobar.text". I have discovered that I can rename it in two
step, one move document command to move it and another to rename it. My
initial test seemed to work if I just moved the renamed the document to
the root level of the of the docs folder - it failed when moved to sub
directories. I'll file a bug report if someone can verify that this is in
fact a bug and not a misunderstanding on my part.
Steve Alex
Mac OS X 10.4.7
4D 2003.latest
Active4D 4.0.3 [Mac/Carbon, release, 4D, Client]
P.S to Aparajita. It didn't get posted the other day because my 3 month
old MacBook started getting SSS (Sudden Shutdown Syndrome) and I sent it
from another system with the wrong email name/alias.
_______________________________________________
Active4D-dev mailing list
[email protected]
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/
_______________________________________________
Active4D-dev mailing list
[email protected]
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/