Join Cris Ippolite for an in-depth discussion in this video Use container fields in your FileMaker app, part of FileMaker Pro 15 Essential Training.
- [Voiceover] Container fields are an important building block for any FileMaker custom app in which you want to store and/or display more than just text, numbers, dates, and times. Container fields are a field just like all the other fields in FileMaker, but they allow you to store binary data. What does that mean? We could store and display digital images or videos. We could play music and sound. We could store electronic documents such as PDF or Excel or Word files, or even packaged documents like zipped up folders' worth of files. All this can be stored inside of a single container field.
Plus container fields, when you use them on FileMaker Go, have all sorts of really compelling features like you can capture bar codes or capture signatures, or playback information or take pictures or store movies or whatever, all of that by just placing this field that's a container field. So what is container field really mean? Well, it's just a field like you see here in our exercise file, in the Customer table. CompanyLogo is a field that has the type of Container. That's it, that's all you have to do. So let's take a look at actually adding one of these to our layout so that we can see the behaviors of a container field.
So we'll go to Layout mode, and I'm gonna choose to insert the container field using the Insert tool up here. Could do it a number of different ways, but I'm going to drop the CompanyLogo field on the layout. I'm gonna choose to not create a label, and I'll hit OK. I'm gonna position this a little bit differently, let's say from the rest of the fields, I'm gonna make it larger 'cause we're gonna look at some of the stuff that's gonna be stored here. So the first thing that you notice is that whereas some of the other fields have text baselines on them, you'll notice that container fields do not.
That's of course because they don't store any text values or data values. They store media or files or binary data. Let's go into Browse mode and take a look at the behavior here. We'll hit Save. Now we see we've got our container field here on our desktop. There's a couple ways we can get files inside of a container field. The first thing that you should know though is that you can only put one single file into a single container field. Doesn't mean that you can't zip up hundreds of files into one single zip file and drag that into a container field.
Or it doesn't mean that you can't have hundreds of container fields defined inside your table and put those on a layout if you want to. But just as far as one container field is concerned, it just stores one file. Couple ways that we can get data in there. Let's say we want to drag and drop data. Let's say for example I see the image here, it's called author.jpg in our exercise folder. I'm gonna drag that and drop it right into the record. So you see that it automatically not only added an image, but it previews the image. What's happening there is that FileMaker uses the QuickTime Player to be able to preview any of the contents of a container field.
It uses the QuickTime Player, and also a bit of a webkit, which I'll show you in a subsequent movie coming up here after this one. But here, if you can open something in QuickTime and preview it, then you can preview it in a container field. So this is great for images, which makes FileMaker an excellent tool for asset management or document management because you can drag these assets in there, share 'em with hundreds of users if you want to, but then also define fields or attributes about that document. If you want to look at examples of that, I would encourage you to go under Get Started, scroll all the way down to the advanced solutions, and look at the Assets tool, check that out.
It's a fully formatted document management system or asset management system that's really built around providing attributes for a container field or documents stored in a container field. So here we have an image. The other thing to look at is when I go to the first record, I don't see the image. So really that's just an example of how the data stored in a container field is data just like any other data in a field. It's just specific to that record. So if we go to the other record here we can see that I could actually drag other assets in here if I want to. Or if I don't want to drag, I could click inside the field, gain focus on the layout, and go under the Insert dialog.
So I could say Insert and then File, for example, and here I could pick a text file. So you can see in the case of a text file, I'm just seeing the name of the file, which is TextFile.txt, and then an icon that represents the file type, which in this case is a text file. If I want to get rid of that file, I can click inside of here, hit the delete key on my keyboard. Another way that I can get data into a container field is by clicking into the field and right clicking. Here I can say Insert Picture and I can go in and add that author picture if I want to, or here's a PDF.
Now one of the things that's interesting about inserting a PDF is that I inserted this PDF document as a picture, so what it's actually doing is storing the PDF, but it's showing me a preview of the first page. So for example if I hit delete and if I drag that in instead, you notice I get the same thing, so it's treating it as if it's a picture rather than a file. If we did Insert, File for example, we'll notice that it treats it as a file in that case.
The way that you're inserting it will depend on how FileMaker's previewing it. You should be aware that inserting into containers has script support as well, and you can choose which types you want to insert in. But this is really just for our training purposes, or in case you're getting different results. Another thing you should be aware of is how you can get this data out. So if I go back to the record that has the image in it, I could click inside of this and then just drag it to my desktop or into an email or wherever else I'd like to. So you've got that drag support there. But also if you right click, you'll notice there's an option called Export Field Contents.
I can use the Export Field to File dialog, pick where I'd like to save that, and simply hit Save. So what I've done there is I've created a copy. You see that the original file still exists in the container field. You can also script the exporting of field contents, so when users hit a button, it can export these out. This is where you can store things like email attachments or any other kind of things that you need to. It's a really compelling feature. But one of my favorite things that you can do with containers is drag in movie assets.
So here we're actually dragging in the Paddle Out movie, so it's kind of a large file size, but we're able to fit it inside of our container. You'll notice that it's only storing it as a file rather than storing it as a previewed movie. Now if we go under the Insert dialog, you'll notice that Audio/Video is grayed out. Now in the next movie we're gonna talk about how we can actually get a audio/video movie to show up in a container field and actually be stored in a way that we can preview it. That's where we're gonna study some of the settings on container fields in Layout mode.
- Understanding the FileMaker Pro interface
- Creating new FileMaker apps from spreadsheets
- Building tables and relationships
- Defining primary and foreign keys
- Working with fields
- Creating, editing, and deleting records
- Importing and exporting data in a FileMaker Pro database
- Creating and formatting layouts
- Finding data and sorting data
- Printing from FileMaker
- Building reports
- Using calculations
- Triggering scripts