Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 3046 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted (edited)

I'm trying to sort out container storage in a solution that originally started on a single machine running FMPro and serving to one other. At that time, containers were used to store PDFs of accounts which were stored by reference and were located elsewhere on the same host machine. Since then, the solution has been moved to FMServer on a dedicated machine on the same network (all Mac). Unfortunately the referenced files were not moved and the files could no longer be accessed remotely from the served solution. At that time, I attempted to import the referenced file to internal storage and then export to another container set up as remote storage but was unsuccessful as the file references could not find the files. To move forward I changed the existing containers to external storage so that subsequent PDFs could be accessed.

I would like to relink the previous PDFs and save them into externally stored containers to restore the functionality of the database. The original scans are still in the same place on the original machine.

My thoughts include:

  • possibly copying the database file back to the original location (or use a backup pre-dating the change from reference to external storage), change to store internally, copy back to the server and then change to external storage;
  • copy the original scans to a folder on the server that restores the relative reference location to the original database file;
  • open the original folder of scans on the server machine by file sharing the old volume and change the file path so the containers can see it again;
  • some combination of the above;
  • something entirely different.

Any thoughts would be greatly appreciated. I'm sure there may be some of my ideas that will ring alarm bells with experienced users so ruling them out quickly would be great.

Another point worth mentioning is that some of the folders have been named with a "/" character (e.g. Invoices 2006/2007) and I'm not sure if that impacts on FileMaker's identification of the file path i.e. if it sees 2007 as a subfolder - I thought this may have been the problem with my early failure to import the referenced PDFs into internally stored files.

Thanks in anticipation of any help that can be given.

Edited by muzz
Posted
3 hours ago, muzz said:

containers were used to store PDFs of accounts which were stored by reference

A container field where a file was inserted "as reference only" holds the path (or paths) to the file. You can see this if you look at the result of:

GetAsText ( YourContainerField )

It should look similar to this:

file:../../../Accounts/Some.pdf
filemac:/Macintosh HD/Users/John Smith/Documents/Accounts/Some.pdf

where the second line is the absolute path to the referenced file.

If you take this path and replace the old location with a new one, e.g:

Let ( [
text = GetAsText ( YourContainerField ) ;
path = GetValue ( text ; 2 )
] ;
Substitute ( path ; "filemac:/Macintosh HD/Users/John Smith/Documents/Accounts/" ; "filewin://serverName/shareName/directoryName/" )
)

and set a container field to the result, that container field should now show the original file in its new location.

 

Make sure you have a backup when you try this.

Posted (edited)
7 hours ago, comment said:

If you take this path and replace the old location with a new one, e.g:


Let ( [
text = GetAsText ( YourContainerField ) ;
path = GetValue ( text ; 2 )
] ;
Substitute ( path ; "filemac:/Macintosh HD/Users/John Smith/Documents/Accounts/" ; "filewin://serverName/shareName/directoryName/" )
)

and set a container field to the result, that container field should now show the original file in its new location.

Thanks for that comment. I've set up a test file but I think I have my syntax wrong as I'm still getting "The file cannot be found". I created the test file and a folder of scans (MyTestFolder) at the root level of the original Macintosh HD. I then uploaded the test file to the server on the other Mac and copied the folder of scans to the root level of the server Mac (also Macintosh HD), so in the end the file paths were the same, however that didn't work. I wasn't sure if the filewin path would work as they were both Macs but couldn't get it to work either -  I tried server name but wasn't sure what shareName was on the Mac.

Could you help me with the syntax of the substitution if the server's hard disk is "Macintosh HD", the folder at the root level is "MyTestFolder" the server is called "MyServer".  I hope that is enough information. Thanks again.

6 hours ago, Wim Decorte said:

Thanks Wim, I will work through that solution if I can't get the above working. Cheers.

Edited by muzz
Posted

I'd suggest you insert a file (as reference) from the server's folder into a container field of the served file. Then observe the path that this action created. Your calculated path must be the same.

Posted

Thank you both, I now have it working. I di have one problem though which is when I script to export the container ("file.pdf") to a temp path defined by a variable ("$path"), then insert "$path" into a new container setup with external storage, I get the message that "file.pdf cannot be found. If I select automatically open when defining the export, it opens as expected so I believe the problem must be with the insert step and I haven't solved it. In the meantime I have been able to export a copy to a folder and insert from there. I can delete the few thousand files once done but I'd like to know where the insert step is going wrong.

I don't have a strong understanding of these things. I wondered if it could be permissions that are the problem but repairing these with a utility hasn't changed the result. I seem to be following the basics of Wim's script although they are all PDFs so I didn't bother trying to differentiate file types and just used the Insert File script step alone.

Thanks again for your help with this. Regards, Murray

Posted
6 hours ago, muzz said:

when I script to export the container ("file.pdf") to a temp path defined by a variable ("$path"), then insert "$path" into a new container setup with external storage, I get the message that "file.pdf cannot be found.

Is it possible you need to insert a short pause between the two steps, to give the system time to create the exported file?

Posted

I tried pausing up to 5 seconds but still no joy. When I tested the file opening with export it was almost immediate and I presume that means that it has reached it's destination ($path) before opening. 

I made another test file (PathTest) and tried that at home with the same script steps and it worked perfectly on my local machine transferring an internally stored file in Container 1 into an externally stored Container 2.

Set Variable [ $path; Value:"file:" & Get(TemporaryPath) & PathTest::Container 1 ]
Export Field Contents [ PathTest::Container 1; “$path” ]
Go to Field [ PathTest::Container 2 [ Select/perform ]
Insert File [ “$path” ]
Commit Records/Requests [ No dialog ]

The solution I am trying is hosted with FMS15 and I am using Apple Remote Desktop to screen share on the Mac with the server and running everything from there with FMP14 on the same machine but still opening it as a hosted file. The script is the same except for the names of the containers.

I can leave it as is without using this script but I'm just confused as to why it doesn't work.

This topic is 3046 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.