HDName text file = "MyFiles"
Path One = "PDFs"
Path Two = "2014"
FileName = "jan2014.pdf"
Calculated FilePath = MyFiles/PDFs/2014/jan2014.pdf
The first three can be Globals, meaning you could move all the referenced files to another hard drive and change one global entry to point all file links to the new location.
Right. I'm all about calculated file paths. Calculating the path is not the issue. Maybe I'm not explaining myself clearly.
Once I calculate the path I use a script step "Insert Picture" to get the image imported as a reference and showing up in the container. Now, how do I change that image without running another "Insert Picture" step again? Once the image is in the container, it is no longer referencing a variable filepath. Even if I make the filepath a global variable, if I change it after I've inserted the image, I have to insert the image again for it to take the new image.
I'm trying to find a way to directly edit the reference path of the container once it is already established. Without another "Insert Picture" step. Does that make sense?
Hi I have learned that you can use GetAsText ( ) to determine a lot of container field locations. It is also helpful with other things were you need to determine what exactly FileMaker is seeing. This file gives an example of how the referenced container is being read. Open it to start with the 1st referenced file so that you can use the New Ref button to see what happens when FileMaker loads a different file. Use the Pic button to load your own referenced picture. Notice the 3 lines that show what FileMaker is seeing from the container field in Pic Info calculation (Main::picinfo). Every time you open it will replace the initial pictures (like start). So I think the answer to your question is, you can build your $path like you see it in the script steps. It is returned with 3 lines that tell about the file and it seems like one is to determine it is a reference.
It is possible to use a script to modify the file path inside a container field just as though it were a text field storing a file path. So once you know what change you need to make to the current file path--whether it be a file name change, a location change or both, you can update the correct portions of the text in the container field to make the needed change.
Hope you are familiar with FileMaker's various text functions as you'll need to use several to make the needed changes.
Ah! I see I can just do it with Set Field. That's awesome. Text functions are not a problem. I love me some text functions.
After playing around with it, I am noticing that typically, the text content of a referenced container field is a three-line value list with size, relative path, and absolute path. But if I set a container field to be only the relative path, it seems to still work ok. Is it a bad idea to ignore the size line and absolute path line? I have been playing around with it quite a bit and I can't seem to find any thing that breaks if I make it only one line. Am I missing something?
Well, before we had the getcontainerattribute function, the only way to get the picture dimensions of an inserted picture....
The format to the text you can extract from a container field is a function of:
a) whether the "by reference" option was specified
b) The option from the Insert menu used to insert the file (and import records|Folder also produces a specific format...)
c) The storage options (external or not external) specified for the container field.
You might find this thread on file paths, $Path variables, Container fields and the script steps that use them of interest: Exploring the use of a $Path Variable in Scripts
It is possible to use a script to modify the file path inside a container field just as though it were a text field storing a file path.....you can update the correct portions of the text in the container field to make the needed change
Can you show an example of such a script? Thanks
An example can only take you so far. You'll need to use GetAsText ( ContainerFieldHere ) to see what form the text takes and how different storage and insert options change what text appears there.
Let's say I Insert a file using insert file with the "by reference" option specified.
The specific text for a folder located on my desktop might look like this:
Let's say that I move the file from the folder named 'forum' to a folder named 'forum demo' that is also on my desk top.
Set Field [YourTable::Containerfield ; Substitute ( YourTable::Containerfield ; "forum" ; "forum demo" ) ]
Would update the reference to the new location. but note that there are many different text parsing tools, both built in and also available as a custom function that you might use to do the needed "text surgery".
I like this technique.
Recently I wondered at notice in FMS13 webd document says
"Only files should be entered as container data. Do not enter text, numbers, dates, times, or timestamps into container fields."
Do you or anyone know about any issue on FMS13?
The sentence is removed on FMS15 document.
Not at all. I think that they were just trying to tell you not to store other types of data into a container field.
I see... makes total sense. Super helpful as usual! Thanks
OK, thank you. I think I will not have chance to use FMS13 any more