Change Containers from Files to Interactive Content in an Instant

By Daniel Wood, 21 April 2015

File versus Interactive

If you are wondering what we are meaning when we talk about files and interactive content it is rather simple. There are two ways in which data can be stored in a container. The first is simply as a file. This is done using the "Insert File" option or script step (without interactive settings chosen).

Items inserted into containers as files are unable to be used as interactive content, and they display as an icon and filename only.  In the past before FileMaker 12 this was the primary method of inserting items into containers, and when it comes to older solutions you will find most have files stored in this manner.

FileMaker 12 introduced interactive containers - a means to make container data more "interactive" funnily enough. It gave the ability to scroll PDF documents, listen to and stream both audio and video direct from containers (and the server).  The problem with this new method of container display was that it did not play ball nicely with container data that was inserted as a file.  Interactive containers on layouts were unable to detect the type of file in a container whose contents was added as a file, and so contents could not be rendered interactively. Below is an example of what a container looks like with a file inserted.

What a container with a file in it looks like

How do we make use of Interactive Containers?

This dilemma arose primarily out of the fact interactive containers can nicely render PDF documents that can be scrolled, opened in preview, printed and saved.  We wanted to use this new feature, but all our existing client solutions prior to FileMaker 12 had their PDF documents inserted as files, and as such were not compatible with interactive containers.

Our initial methods for making the fix were rather crude and involved writing scripts that would loop through records, exporting container contents to the temporary folder on disk, and then re-importing that back into the same container, albeit this time as a PDF, such that it could be displayed interactively.

The process was tedious and time consuming, not to mention hard to setup for multiple containers on a large solution!


Introduce Stephen the Bright Spark!

Recently our most experienced developer Stephen was musing over this very issue for one of his clients solutions that house literally thousands and thousands of PDF's, which by the way are all hosted on remote volumes.

How could he display these PDF's as interactive content, without the hassle of exporting and re-importing? and then it hit him!

Actually, we're not quite sure how it hit him, but it's a little bit of luck, combined with a little stroke of genius, and he cracked it!


Base64 Encoding and Decoding is the key!

Stephen tested and showed that if you use FileMaker 13's Base64Encode and Base64Decode functions, you can convert container data into interactive container data, here's how it works:

Base64Decode ( Base64Encode ( Container ) ; Filename )

That's it!  He realised that the encode function simply encodes data with no knowledge of its file type.  The decode function however requires you to specify a filename with extension. This is the key thing, decode function will turn the encoded text back into a file of the nominated stream depending on the extension you choose.  All you need to do is make sure the filename is the same as the original files name and you're all set!

In fact if we look at the definition for Base64Decode we see:

Base64Decode ( text {; filenameWithExtension } )

It explicitly requires an extension for this very purpose.


Putting it to use

There are a number of ways to make use of this. in Stephens case, he wanted to keep the files exactly as they were untouched so did not replace the container data. However he created an unstored calculation on the table with the container, and set it to the above function. He now had a calculation that can render the container as interactive content that he could use on layouts where needed.

You can also write a very simple replace script that can update all container data in a single step.

The example file attached below illustrates this. Here we have abstracted it all into a single custom function called "Interactivate" that is passed a container as a parameter. The output of this is the container data turned into interactive content.  Simply run this function over any container you want to update to interactive content.


Example File

Please find attached an example file. This file is provided to help you fully understand what is going on in the rest of the article above. Note that FileMaker 13 is required to view this example file as it uses FileMaker 13 specific functions.

Click here to Download the Example File

Something to say? Post a comment...


  • Marc Berezin 23/05/2022 6:06am (2 years ago)

    I need some help. I'm trying to enable users to view the entirety of multi-page pdf's into an interactive container field (FMP 19, FMS 19, Mac). I created the "Interactivate" custom function as in your sample file, and after the script step "Insert file" or "Insert PDF", I used the Replace Field Contents step (interactivate ( prns::receipt1 ) to execute the function. What the container field displays is this:
    and on and on.
    What am I doing wrong?

  • Daniel Wood 22/06/2020 11:14am (4 years ago)

    hi Mark, thanks for the nice comment and apologies for the late response as I have been on leave.

    This should work on Windows 10. I have just tested it on our Windows 10 machine and it worked as expected (was tested in FMPA17). Can you tell me which version you are running, and what you are seeing (if anything) - is it a specific example that is failing or all of them?

  • Mark Rubenstein 11/06/2020 8:47am (4 years ago)

    Brilliant!! Works for me on Mac... but not Windows 10. Should it work on Win?

  • Daniel Wood 10/10/2019 9:46am (5 years ago)

    hi Aaron, thanks for the comment I"m glad it solved your problem :)

    Make sure in your solution to change any areas where you insert files using the "Insert file" step to have the option to show content where possible (this will ensure future PDF's inserted are interactive).

  • Aaron Stead 10/10/2019 12:20am (5 years ago)


    Was having issues with a client's database and most threads I found online didn't offer a solution, just going over lots of potential issues of why pdfs were not showing.

    I set up a separate calc field with the above calc in it and it worked like a charm. The main thing I'd say for anyone trying this and it's not working is make sure the calculation result is set to container, and it's unstored.

  • Daniel Wood 30/07/2019 2:52pm (5 years ago)

    hi Stuart, thanks for the comment. That's odd that it doesn't work for you in 17. I've just tried the demo file in FileMaker Pro Advanced 17 and it seems to work as expected, which leads me to ask a few questions. Firstly, are you saying that it does not work at all for you in FileMaker 17, or a specific solution you have built, that just happen to use 17 for? Is there anything different about this solution in regards to access privileges around modification of a container field?

    Have you tried other simpler PDF documents perhaps? Size of the document could be a factor? Are you able to try in 18?

    if you're still having issues and are able to send me a sample version/solution for me to test I'd be happy to look into it for you. You can contact me at .

  • Stuart Lynn 29/07/2019 12:58pm (5 years ago)

    This seemed like an answer to my FM prayers. It worked beautifully when I plopped a pdf into your example db. However, it did not work when I tried to use the same approach in my FM17 app. What am I doing wrong?

    Thanks so much for tackling this problem. I would never have figured this out myself, of course ;-(

  • David Vu 24/04/2019 11:47am (5 years ago)

    It works like a charm. Thanks so much.

  • Troy Thomas 23/06/2018 2:05am (6 years ago)

    Confirm works in FM 17 - PSOS. Thank you!

  • Antonio 25/09/2017 10:07pm (7 years ago)

    Unfortunately under Windows it does not work. It seems to be just for MAC

  • Adam Glick 23/09/2017 5:36am (7 years ago)

    This. Is. Genius.
    Thank you for this very elegant solution - I was facing this exact issue today with a client with many embedded historical docs. Well done!

  • Antonio 31/08/2017 7:00am (7 years ago)

    Anyone have a tip to work this solution on Windows 10 System? Thanks

  • Antonio 23/07/2017 5:56am (7 years ago)

    Hi , i've try in FM 16 OSX Sierra 10.12.6 and working but not on FM16 Windows 10 64 bit. Any suggestion ??

  • Matheus Molin 22/07/2017 8:47pm (7 years ago)

    Congratulations and thank you, guys. Your solution is just simple e amazing! We are using this a lot. Thank you for share it.

  • Michelle Boatman 20/07/2017 9:44am (7 years ago)


  • Daniel Wood 20/07/2017 9:40am (7 years ago)

    Okay so, you'll have a container field in your solution, and that container will be on a layout somewhere lets say. In layout mode, in the inspector data tab, go to the bottom and ensure that under "data formatting" it is set to be an interactive container.

    The goal of this article & this calculation is to change what is in your container into a version that can be interactive. Often in old solutions files inserted were inserted in a way that meant they are not compatible with being interactive. Note also only certain file types are going to work here, you still can't preview things like word documents or excel files.

    Your container field should not be a calculation, it should just be a standard container containing a file like a PDF.

    Your goal is to replace the contents of the container with the result of the calculation. You can do this by using a script. Create a script, and your script just needs a single "Set Field" script step in it. the field in the script step you are setting should be your container field, and the result of the set field will be a calculation shown in the previous comment.

    E.g. if your container is in a table called "Customers" and is named "Policy Document" , then your script step should look something like this:

    Set Field [ Customers::Policy Document ; Base64Decode ( Base64Encode ( Policy Document ) ; GetContainerAttribute ( Policy Document ; "FileName" ) ) ]

    The reason why in the demo file we put the calculation instead into a custom function was to that it could easily be reused throughout a solution where needed, and it also makes things easier to read.

    If you are still having trouble, and are able to, just zip your database file & email it to me and I can take a look and find what the issue is you are having.

  • Michelle Boatman 20/07/2017 9:35am (7 years ago)

    Yes sir, I'm sorry, not a script, I did it as a calculation on my actual container field. I still only see my .pdf icon and I deleted the <<YourContainer>> and this is what my calculation looks like:
    Base64Decode ( Base64Encode ( Policy Document ) ; GetContainerAttribute ( Policy Document ; "FileName" ) )

    It's still only showing my icon when I save my changes.

  • Daniel Wood 20/07/2017 9:25am (7 years ago)

    hi Michelle,

    No, "FileName" is correct, what you need to swap out is <<YourContainer>> for the reference to the container field you want to transform.

    The below is not a script, it is a calculation, you'll have trouble if you are trying to add it as a script :)

  • Michelle Boatman 20/07/2017 9:23am (7 years ago)

    Thank you Daniel. I greatly appreciate your quick response and your help. I do have Advanced and I'm inputting the script as below. It is still not working for me though. Am I suppose to put something in place of the "FileName"?

    Please forgive me, I'm still fairly new to this.

  • Daniel Wood 20/07/2017 9:03am (7 years ago)

    hi Michelle,

    The technique doesn't really use a specific script, rather it is a custom function calculation. If you do not have FileMaker Pro Advanced then you are unable to add a custom function, however below I have just put the calculation that is used in the function, you can use the below in your own calculations, or write a script that uses it:

    Base64Decode ( Base64Encode ( <<YourContainer>> ) ; GetContainerAttribute ( <<YourContainer>> ; "FileName" ) )

  • Michelle Boatman 20/07/2017 8:51am (7 years ago)

    I'm having trouble putting this into my script for my FileMaker 16. Is this only for FM13? Do you know what the script is for 16?

  • Ben Miller 01/04/2017 12:02am (7 years ago)

    Thank you very much for sharing this.
    I've been struggling when moving attachments between files and tables. Sometimes they work interactively and sometimes they don't. Now I know why and I can stop tearing my hear out and get back to work!

  • Craig Wall 22/03/2017 6:06pm (7 years ago)

    Thanks! Working here.

  • Lisa Huala 19/07/2016 9:14am (8 years ago)

    Yep definitely crashes FM. It works fine the first time I populate the global container optimized for interactive content but if i go to layout and then back to browse and the container has to redraw CRASH! And if i clear the field, then attempt a second population of global interactive container, CRASH!

  • Lisa Huala 19/07/2016 8:17am (8 years ago)

    I have installed and used this to move container files that are PDFs (inserted as files) into a global container optimized for interactive content. It seems to work, and I can see that the pdf is there but then the pdf control bar at the bottom of the field disappears and the scroll bar at right of the field does not scroll. When i do the operation again, in an attempt to get the pdf controls back FM crashes.
    I am using FM13 locally on my laptop.
    Any ideas?

RSS feed for comments on this page | RSS feed for all comments

Categories(show all)