Join Cris Ippolite for an in-depth discussion in this video Using container fields in your database, part of FileMaker Pro 12 Essential Training.
Container fields are an important building block for any FileMaker Pro database in which you want to store and/or display more than just text. With container fields, your database solution can actually store and display digital images or videos, play music and sounds, store electronic documents like PDF, Excel, or Word files. And really, a container field is so versatile that it can store any sort of binary data. Binary is just a generic term for data that cannot be represented as text. Container fields can hold up to 4 GB of binary data in three broad classes, either as an image, a QuickTime file--and when we say QuickTime file we mean multimedia files that are supported by QuickTime 7.5, and that's actually a pretty broad range--or files of any type, and I mentioned PDF, Excel, Word, those type of things, but really anything that you can work with on your computer, you can store inside of container fields.
So if you open up the Exercise File 06_01, and if we go into Layout mode, it's the first time we've worked with Layout mode and all I am going to really do here is add the container field to the layout so that we can work with it a little bit, we'll get to more of that in the upcoming chapters. But you'll notice that all the different fields that we see here in Layout mode, some of them have text baselines and one of them doesn't. That's because this one here is actually our container fields. So what I am going to do is I am going to Shift-select these two things, and I am going to move it over into this white space and move it around with my cursor, and I am going to drag this into a large area in the middle of our screen. This is our container field that happens to be called CompanyLogo.
Now, if we go back into Browse and Save our changes, you'll notice that if I click into this field and try typing, it won't let me do so. The only way to get data into a container field is first by selecting it so it's focused, and I've just selected the field, and we see that it's got the dark edge around it, unlike the edges here, if I click PhoneNumber, now that gets the dark edges around it and everything else has the dotted lines. But if I go under the Insert menu while I've got the container field selected, you see that I've got some options for inserting some values. You see here that we've got Picture, QuickTime, Sound, and File.
However, we do have options for Audio/Video and PDF, but they're currently grayed out, and I'll get to why that is in a second. But first, let's look at how files can be stored using the options that are available to us now. So let's start by adding a picture, and I am going to pick Picture and then from our exercise files I am going to choose a file that's called author.jpg and select Insert. Now you can see the picture in the field. Notice that when you navigate back and forth from record to record that the picture only appears in the record in which I embedded it just like any other data that you put in a field.
If we click into the field and now hit our Delete button, you'll see that it removes the value, and that's how we can control data inside of a container field. There are actually a couple of different ways to get data into your container. For example, in FileMaker 12, drag and drop is supported. So you'll notice if I make this window a little bit smaller and reveal our Exercise Folders, I can click on the author image and drag it into the container, and it now populates that database record with this image. You can also control data in the field by right-clicking the field or Ctrl-clicking on a Mac.
You see here I can cut the value if I want to get rid of it, or I can insert another value into the field if I'd like to, or I can extract the data from inside this record by hitting Export Field Contents. Of course, being able to store any type of document in a container field does no good unless you can get the documents out again when you needed them, and that's where Export Field Contents comes into play. So when this file is shared, users can export data out of a container field that they didn't necessarily put in the first place. It becomes a very nice file repository or asset repository database in that regard.
So let's clear out this image and try working with some other files. You see that over here we've got a file called TextFile. I drag that into the container. Now, in the case of a text file or any non-image or non-video file, first it's storing the document in the container, like we've instructed it to, but what it's doing is it's actually just showing us a preview of the file type, in this case text and then showing us the name of the file. We of course still can do the Export Field Contents if we want to, and we can control it by deleting the value if we'd like. And we'll see when we drag a PDF into the field, what it does is it actually shows us an image representation of the first page of the PDF. We can't necessarily interact with this at least at the moment, but it does give us a little bit of a preview and of course allows us to still do the Export Field Contents. Now, you'll notice that I've been adding one field at a time to each container. If you try to add more than one field--for example, if I have an image and then if I now try to add PDF--you see what it actually does is replace the value that was in there before. So there is only one file per container field, but you can either do one of two things, create more container fields if you need more files stored for each record, or you can compress or zip our package up multiple different files into one single compressed file and then upload that into your container field. So let's clear out this file, and let me show you what it looks like if I go into Insert, and I pick QuickTime, and I am going to choose this video called Paddling Out, and I am going to hit Insert. And now you see what it does is it gives us a Play button across the bottom, this is the QuickTime engine kicking in here. If for some reason you insert something, particularly on Windows, and you get a cannot play file error in the image here, what that means is that you need to go and install QuickTime player. QuickTime player is going to be installed as part of the normal FileMaker installation, but if you've chosen to dismiss that you'll have to go and install that player onto your computer so that you can actually interact with this content. So here you'll notice that I can click on it.
And we can control the video, we can watch the video, and we can see it interact, and this is something that of course can not only be shared with other users, but each record could have its own video if necessary. The same is true for audio files. The audio files can be played by QuickTime, we can control the volume, and we'll get a Play button, but what it will look like is just this strip without any of the corresponding video. You will notice though that in the Insert option we have no access to Audio/Video, even though we were able to add video in QuickTime. And no access to PDF, even though we were able to add a PDF document as a file. I am going to show you in the next video how we can configure those and what additional options that will give us. Another thing that I wanted to show you, if we delete one of these files in the container and right- click in and say Insert a File, and we'll choose text file, you'll notice over here on the bottom left-hand side that we've got a couple of options available to us. The first one I want to show you is Store only as a reference to the file. If I choose that, it still embeds the file into the container field, but what it's done is embedded only the path to where the original file can be found. So right now the original file can be found on my Desktop, in the exercise files folder, in a subfolder called 06_01. But the problem is if I move that file and other users want to try to access it, now I get this error that says this file cannot be found. And the reason is because FileMaker is simply storing the path, and it's not storing the file itself.
Now, when I go back and put the file back where the file can be found, we can see it. So it's a great tool to be able to not have to embed images, like, for example, if we had a very large video let's say, it's about a gigabyte in size, I could choose to store a reference, but that path must be maintained at all times. In upcoming videos I am going to show you how you can set your container fields up so that none of that matters. But keep in mind in the meantime when you see those options in the bottom-hand left corner, this is what they're referring to. FileMaker container fields are very special types of fields that allow you to store media files and files within your database record. FileMaker 12 has also provided many different options for managing these stored files.
- Comparing flat vs. relational databases
- Creating databases from templates
- Determining what tables you need
- Understanding relationship types
- Defining key fields and creating relationships between tables
- Creating fields
- Using new FileMaker 12 container fields
- Creating, duplicating, editing, and deleting records
- Importing and exporting data
- Managing layouts and layout objects
- Applying new FileMaker 12 themes to layouts
- Finding records and working with found sets
- Building reports and charts
- Authoring calculations
- Creating and triggering scripts
- Working with relationships in scripts, calculations, and charts