May 25, 200718 yr Newbies I've been using/programming with Filemaker for a while, but I need help on how to do something. I want to fill a container field in a record with a picture. Normally, I would do this with the "Insert/Picture" menu item and have it stored as a reference. Each container's reference could be from anywhere on my hard drive - not necessarily a single folder. However, the picture will never move once referenced. Once this picture is referenced by my database, I want to have its absolute path as text. I can then use this text to attach an original file to emails, etc. What type of script/function/etc. can do this? I only see Filemaker solutions for this by importing an entire folder's contents at once - not by inserting a single photo. Help! Thanks.
May 25, 200718 yr Grabbing the path out of a Container field is actually quite easy. All you have to do is create a calculation with a text result and it will display the path. You could create the calculation in a script as well. To create an email, try this script: Set Variable [$Path; Value:MYTABLE::ContainerField] Send Mail ["$Path"] $Path is used in the attachment portion of the Send Mail script step.
May 25, 200718 yr You can script your Insert Picture. There is a script step. So you need to go Go to Field [yourfield] and then Insert Picture []. You can extract the path if stored as a reference by using: GetValue ( GetAsText ( test ); 3 )
May 26, 200718 yr Author Newbies Thanks for the input from both of you. I've tried these, and neither will give me the full path. Both will return only the filename. Actually, the GetValue ( GetAsText ( test ); 3 ) will not return anything. Changing the last value to 1 will then return the filename. I need something that would return something like this: Drive:Folder:Folder:picture.jpg If it matters, I'm using Filemaker Pro 8.5v1 and its on a Mac, System 10.4.9.
May 26, 200718 yr Both will return only the filename. That will happen if you insert the actual picture into the container, instead of selecting 'Store only a reference to the file'.
May 26, 200718 yr Author Newbies Could have sworn I hit that button! That did it. Thanks for the help!
May 28, 200718 yr rcscalebuilder: Could you please post exactly how you got this calculation to work? I tried it as mentioned above (the GetAsText function) but, depending on the type of file in the container, it seems to return different information such as the filename or the file size.
May 29, 200718 yr For me, when I use this function, if I insert a file called "document.doc" into the container, then only the filename "document.doc" is displayed in my External Path field, which is calculated using GetValue(GetAsText(container);1). If I insert only a reference to the file, the output of the GetValue function changes to "file:document.doc". It doesn't actually display the full path. Any idea why? Ideally what I would like is the output to be "Driveletter:Folderdocument.doc".
May 29, 200718 yr Hi Mike, This may seem like a dumb response, It doesn't actually display the full path. Any idea why? Ideally what I would like is the output to be "Driveletter:Folderdocument.doc". How big is your field? If you click into it, does the whole path show up? Lee
May 29, 200718 yr Hi Lee Right after I posted I figured out my problem. The text output from the container field is two values: the filename first, followed by the full path. You have to expand the field in order to see the whole thing. I used the following calculation to grab the path name and report it: =Replace(GetValue(container;2); 1; 9; "") Explanation for others reading this: The GetValue function pulls the full driveletter/path/filename information for the file in the container field called "container". Since the full path information is the second value returned by GetValue, the parameter 2 is specified. The path is returned in the format: "winfile:/C:/Folder/Filename.doc". (If you're on a Mac, I think it returns "macfile:/.....".) Since I didn't want to display paths with "winfile:/" at the beginning, I nested the GetValue function in a Replace function that replaces the first nine characters of the returned path ("winfile:/") with nothing (""). Works like a charm. Note that you MUST insert a reference to the file and NOT the actual file itself in the container for this to work.
Create an account or sign in to comment