June 15, 20169 yr Newbies I'm using Filemaker Pro 11 in Windows 7, trying to automate the exporting of files from container fields. I've written a script that goes through all the records to export the files in the container fields while skipping empty container fields. The code works well, except that there are a number of records with container fields where I get the "Container fields cannot be exported." error. When I try go to these records and try manually exporting the container field contents by right clicking, the "Export Field Contents..." option is grayed out, though I am able to open the document and then manually save it. There are, however, way too many of these cases for me to practically do this one by one, so I'm hoping if someone has an idea what's going on here and how I might be able to automate the exporting of these fields that are giving me this error. To help me troubleshoot this, I wrote a shorter code that focused on exporting the field contents of just one record. This helped me figure out which records were giving me this error. Here's the code: If[not(isEmpty(TABLENAME_::FIELDNAME))] Set Variable [$filePath; Value:"filewin:" & Get(DocumentsPath) & TABLENAME_::TABLE_ID_FIELD] Export Field Contents [TABLENAME_::FIELDNAME; "$filePath"] End If I've been searching and trying a bunch of different things, but with no luck. Any tips and pointers would be greatly appreciated. Thanks!
June 15, 20169 yr In a record where you cannot export the container field, what do you see as the result of GetAsText ( YourContainerFiled )? This may return several lines, so make sure you see them all. Also, how exactly do you "open the document"?
June 17, 20169 yr Author Newbies Thanks comment. When I use GetAsText(MyContainerField), I get "?". How would I make sure that I've seen all the lines? I "open the document" by right clicking on the icon within the container field and selecting "Open Document". Thanks! On 6/15/2016 at 5:38 PM, comment said: In a record where you cannot export the container field, what do you see as the result of GetAsText ( YourContainerFiled )? This may return several lines, so make sure you see them all. Also, how exactly do you "open the document"?
June 17, 20169 yr 2 hours ago, Cyrus said: When I use GetAsText(MyContainerField), I get "?". How would I make sure that I've seen all the lines? if you're doing this in a calculation field, make sure the field is tall enough. Although if the first line is "?", there probably won't be any subsequent lines. 2 hours ago, Cyrus said: I "open the document" by right clicking on the icon within the container field and selecting "Open Document". And what exactly is the nature of this "document"? Could it be that your solution is really old and contains linked/embedded OLE objects? Edited June 17, 20169 yr by comment
June 17, 20169 yr Author Newbies 2 hours ago, comment said: Could it be that your solution is really old and contains linked/embedded OLE objects? Yeah, I have documents going back to 2006, I think OLE objects are a possibility. How would I be sure that what's in the container field is an OLE object? Thanks for you help! Also, I just used a custom dialog in a short script to see the output of GetAsText() and the only thing I see is "?".
June 17, 20169 yr 37 minutes ago, Cyrus said: How would I be sure that what's in the container field is an OLE object? I don't really know. What kind of document opens up, in what application? Excel? Word? Also, can you post a screenshot of the shortcut (right-click) menu?
June 17, 20169 yr Author Newbies The kind of document depends on the kind of file. A good number of these are PDFs, but some appear to be images. The images, interestingly, open in Word. Attached is an example of the right click menu with a PDF (possible) OLE object and the right click menu of an image.
June 17, 20169 yr Well, I am reasonably certain that 'Edit Document' would only appear if the field contains an OLE object. And I would guess the same about the PDF - if only because 'Export Field Contents…` is greyed out. Edited June 17, 20169 yr by comment
June 17, 20169 yr Author Newbies Thanks, yeah, I do think it's an OLE object from everything that I've been reading. Is manually opening and saving these files one by one the only way to get these OLE objects out, or is there some other way I can get these out quickly? If not, do you know of a way to at least search for all records with OLE objects? Any tips on this would be appreciated. Thanks!
June 17, 20169 yr 16 minutes ago, Cyrus said: Is manually opening and saving these files one by one the only way to get these OLE objects out, or is there some other way I can get these out quickly? If it's at all possible, it would have to be automated using OS-level scripting, not natively in Filemaker. I am afraid I know practically nothing about doing that in Windows. 19 minutes ago, Cyrus said: do you know of a way to at least search for all records with OLE objects? Searching for ? in a calculation field defined as GetAsText ( YourContainerField ) should find all of them, I think. But it also may find others, e.g. images pasted directly into the field. Do you get an error when you try Export Field Contents [] in a script? If yes, you could loop through the found set and omit those that do not return an error.
Create an account or sign in to comment