AnsweredAssumed Answered

Get file name and file size from a container field

Question asked by DrTim on Apr 18, 2010
Latest reply on Mar 29, 2013 by JohnEriksson


Get file name and file size from a container field


Hi!  New to this forum but not to FMP, altho just now using v.11.  Hoping someone can help with a problem that has me stumped.


Developing an app with starter Document Library as basis, but instead of typing in a file name then using the Insert File button, I want to use Insert Object to insert a linked PDF file in the File container(1 per record), which I can then dbl-click to bring up the original file if I wish.  No problem there - works fine.


But then I want to have the File Name (and File Size) fields automatically display that info based on the PDF in the container.  I have tried both a (new) script for the Insert File button and a field def for File Name as a calculated field, both using GetLayoutObjectAttribute(File,"content"), which should return a text data type but either is not working or is returning an empty string.  (I also added GetAsText function later to the same calc, just to be sure.)   Same thing happens when I substitute "objectType" or "bounds", etc for the attribute name.  I know the container insert is working OK because the PDF appears there and the link to the original file works fine.  Still no joy if I embed the inserted PDF instead of linking, or if I insert as a file or picture instead of as an object.  No matter what I do the other fields I want to automatically fill in with the file name (or path) and file size remain empty.  Like I say -- I'm stumped!


Can anyone help?  Many thanks!