Containers store more than just file paths. If the format of the filepath isn't exactly correct, the method you describe won't work, But it's much much easier to discard your text files and insert your files with the "store a reference" option enabled. This inserts the file path reference directly into the container field and you don't have to worry about getting the format correct.
You may also find this thread on $Path variables, container fields and the script steps that use them helpful. You can download the demonstration file, modify a layout to make the container an interactive container, insert the PDF "by reference" and see the exact text your calculation would need to produce in order for your container field to work. (And you must select "container" as your calculation field's result type.
PS. you can also use a Web Viewer to display your PDF's by updating a field that the viewer references for it's URL and set up a "FIle" URL with the file path.
Wow Thanks, I don't know very advanced scripting so I was banging my head against a wall for weeks, and your URL web viewer workaround seems to be doing the trick. I just am having the button send "file:///"&(FilePathField) to the web viewer and it loads super quickly, much quicker than a PDF container field seemed to be operating anyway.
Thanks for the help.
Hey, just to follow up on this... I ended up using the web viewer method and it was working great, except now I need to have excel spreadsheets and word documents also view within this viewer window in Filemaker. PDF's work great, but any other file format prompts a window that opens the file separately outside of the Filemaker database. Any suggestions on how to solve this problem?
I know of no way to do that in a web viewer.