8 Replies Latest reply on Oct 25, 2012 3:14 PM by philmodjunk

    Container Field Inconsistency

    tomstock1337

      Summary

      Container Field Inconsistency

      Product

      FileMaker Pro

      Version

      12.03

      Operating system version

      Windows 7 Enterprise

      Description of the issue

      I have created a student record database and I have a document table with 18 fields (one of which is a container field), 1900+ records with a pdf file stored internally in the container field.

      A student may have 20-30 records shown in a portal view.  When a button is clicked in the portal view, a layout is shown containing a field for the document displaying Interactive Content with "Start Playback Automatically" checked.

      When the layout was originally created, only about 100 records were created when "Interactive content" was not checked.  Once I found the "Interactive Content" option, I clicked it.  All new documents entered are displaying in a pdf viewer in the container field without issue.  All old documents are just showing a thumbnail of pdf icon.

      I am able to export these documents to view them, however, this is not feasible when reviewing documents of the students.  Any help would be appreciated.

      Steps to reproduce the problem

      See description for scenario, I am not sure how it can be reproduced

      Expected result

      The container field should always display a pdf viewer when interactive content is selected and the contents is a pdf file.

      Actual result

      The container field selectively goes to either a thumbnail or pdf viewer when viewing the document in a layout

      Workaround

      I am able to export the document, delete the document currently in the field and then re-add the document and it will use the pdf viewer.

        • 1. Re: Container Field Inconsistency
          philmodjunk

               If interactive content was not specified, then a different menu option than Insert PDF was used to insert the PDF file. You should be able to use ecport field contents to export the file, then re-insert it with the Insert PDF option to get the interactive features that you are missing. IF you can pull up just these records in a found set, a script could be used to put in the fix.

          • 2. Re: Container Field Inconsistency
            tomstock1337

                 The PDF files were drug into the field using drag and drop.  Insert PDF was not explicitly used.

            • 3. Re: Container Field Inconsistency
              philmodjunk

                   Which is the functional equivalent of Insert File, not Insert PDF. You've done this for all the files, both before and after the layout change?

                   I'm surprised that worked.

                   Re-inserting the files still represents your best bet for fixing this, I think. You might add a button for this next to the container field and click it each time you see a case where you can't see the contents in the container field.

              • 4. Re: Container Field Inconsistency
                tomstock1337

                     Dragging and dropping the files were used for 99.99% of all of the file insertion before and after the layout change.

                     Are you referring to a button that would execute a script to export and then re-import?  Do you have a pseudo-script that I could work off of for addressing this issue?

                • 5. Re: Container Field Inconsistency
                  philmodjunk

                       Go To Record/Request/Page [First]
                       Loop
                          Set Variable [$FileName ; value:
                          Let ( [T = GetAsText ( GetValue ( YourTable::containerField ; ValueCount ( ContainerTest::containerField ) ) ) ;
                                   L = Length ( T )];
                                   Right ( T ; L - Position ( T ; "/" ; L ; -1 ) )
                           )
                  ]

                          Set Variable [$Path ; Value: Get ( TemporaryPath ) & $FileName ]
                          Export Field Contents [ YourTable::ContainerField ; "$Path"]
                          Go To Field [YourTable::ContainerField]
                          Insert PDF [$Path]
                          Go to Record/Request/Page [Next ; exit after last ]
                       End Loop

                       Note: Text in Blue is the entire calculation for the set variable step for $FileName. It should extract the file name from the container field regardless of the method used to insert the file and whether or not "store a reference" was specified.

                  • 6. Re: Container Field Inconsistency
                    tomstock1337

                         Going out on a limb, I tried to create a second column (Document2) and Replaced the Field Contents of the column Document2 with Document1.  All of a sudden the Document1 column was working correctly for the affected records.

                          

                         Looking through the script options I came across the "Insert File" script command with the following special dialog options:
                         "For images and interactive content, you can display either the file icon or the file content.  Some files can only be displayed as icons.

                         Display: Icon with filename
                                        Content of file (when possible)"

                         My guess would be that this flag could be toggled on a columnuar level to prevent this from happening in the future.

                    • 7. Re: Container Field Inconsistency

                           @All:

                           Thank you both.

                           PhilModJunk's script is great; however, I recieved an error without first adding an additional variable to append "image:" onto the file path. I am attaching a screenshot below of the reworked script. 

                           TSFalcon
                           FileMaker, Inc.
                      • 8. Re: Container Field Inconsistency
                        philmodjunk

                             Thanks for the "catch". As an added note, be very careful with the image, imagemac, imagewin and file tags. Don't know if this is still true with FMP 12, but in 11, they are case sensitive tags and the wrong captital letter can produce and invalid file path.