AnsweredAssumed Answered

Using External Open storage, How To Copy/Move/Rename [LONG]

Question asked by rickenbacker360 on Mar 11, 2016
Latest reply on Mar 13, 2016 by wimdecorte

 

Sorry for this wall of text. The more I write, the more you can understand the nuances of my issues. I’m sure I’m missing something. Thanks for any help you can give.


(Oh, BTW, I did Download the very nice philmodjunk example file and failed to get my head around things for my needs.)

 

In a cross-platform solution for Windows and Mac, I have need for a “Gather” function in my Documents Management Feature. Users can have a found set of legal contract parent records, each with many child documents attached (each residing in a container field). One-to-Many relationship. It’s possible for users to attach the same document more than once to a given parent. (They shouldn’t, but hey…)

 

Prior to FMP12, I required use of a dedicated document server and users attached all files by reference. With FMP12 and the ability of FileMaker Server to store the files, I’m rewriting the feature.

 

Now, using External (Open) storage on the FM Server [Hosted Location], for my Insert File script step, I use “Insert” not “Store by Reference” and most of my existing features work, allowing users to Open or Email the attached files.

 

Prior to FMP12 (and my current intention), I had users make a “Temp Docs” Folder on their desktop. I prefer it to be in their Documents folder if I succeed in the rewrite.

 

The problem I have is trying to copy/move/rename the externally stored files.

 

Problem 1 is that I cannot get a copy of the externally stored file to reside in “Desktop/Temp Docs” at all.

 

Problem 2 is that if I use the “Documents/Temp Docs” folder, the files do not populate “Temp Docs.” Instead, they reside at the root of “Documents” which defeats the purpose of “gathering” the files. (I want them inside a single folder.)

 

Problem 3 is that they do not have certain “meta data” such as parent primary key and an iteration counter I’m trying to append to their existing (externally open stored) names. For example, how do I append “L12.49_0001~” to the beginning of the externally stored “FileName" to get this result: L12.49_0001~FileName.docx? And, of course residing inside either "Desktop/Temp Docs" or "Documents/Temp Docs" (preferred)?

 

Prior to FMP12, the “Temp Docs” Folder would successfully contain gathered files similar to this:

L12.49~FEE-0114.pdf

L12.49_0001~Phone Number List.xls

L12.49_0002~FEE-0114.pdf

Where everything to the left of the tilde (~) is the originating Table designator and primary key. FTR, If the found set of documents, having many different parents has more than one iteration of a particular file for the same parent, the number counter advances. Of course, this info is merely informative.

 

Similarly, when I use “Get (DocumentsPath)” instead of “Get (DesktopPath)” and the Documents Folder also contains a folder named “Temp Docs” the gathered files do not go inside the “Temp Docs” folder. Instead, they simply go to the root of “Documents” folder. They don’t have the stuff to the left of the tilde (~) either.

 

Code which no longer works (but used to):

#REQUIRED: End user must have a folder on desktop named identically: Temp Docs (If I can have this folder inside "Documents" folder, it would be great.)

 

Go to Field [ DOCS::DocContainer ]

 

Set Variable [ $ExportPath; Value:Get ( DesktopPath ) &

 

"Temp Docs/" & "L" &

 

#Get the two components of the primary key and the file iteration counter. ($Count advances through a looping routine.)


Abs(GetAsNumber(Table A::SerialNumberPartOne)) & "." &

GetAsNumber(Table A::SerialNumberPartTwo) &

"_000" & $Count & "~" &

 

Get ( ActiveFieldContents ) ]

            Export Field Contents [ DOCS::DocContainer; “$ExportPath” ]

 

I’ve also been using this code to no avail as I try to make things work:

 

Get ( DocumentsPath ) &

 

"Temp Docs/" & "L" &

 

Abs(GetAsNumber(LEASES::SerialNumberPartOne)) & "." &

GetAsNumber(LEASES::SerialNumberPartTwo) &

"_000" & $Count & "~" &

 

"[Hosted Location]/LEASES/LEASES/" & Substitute ( GetValue( DOCS::DocPath; 2 ) ; "FILE:" ; "" )

 

#Note that [Hosted Location]… etc. above works fine for OPEN and EMAIL functions. Also note that the Substitute function grabs line 2 of “DocPath” which is, for example:

remote:FileName.docx

FILE:DOCS/DocContainer/-1_1FileName.docx

 

Kindly be specific in your answer, thanks.

Outcomes