FileMaker Function of the Week: GetContainerAttribute
GetContainerAttribute: This function has 35 different arguments that you can send to it to get specific information about the item in a container field. FullCity Consulting gives us the use of the few of the more fun ones, and the full list is below:
New in FileMaker 13, and previously fawned over in this very blog, is the GetContainerAttribute function. Prior to this, when you dropped a file in a container field, you had few options for getting information about it. There wasn’t even a foolproof way to determine what kind of file was in there. Imagine setting up a container field for storing audio only to find out later that people had been dumping images and spreadsheets in there. You just had to hope everything was being used as intended.
With the advent of GetContainerAttribute, we can now reliably get the name, size, and a few dozen other bits of info about the contents of a container field. But let’s start with the fundamentals.
To invoke the function, two parameters are required inside those parentheses. First is the name of the container field. If you point the function at a non-container field, the function will fail and simply present a question mark for a result. The second parameter is the attribute you wish to obtain. It’s important to put the attribute name in quotes or FileMaker will think you’re referring to a field here.
The last argument listed in the FileMaker documentation is “All”, and it will return a list of all of the previous 34 commands. Just for fun, here’s the full list:
General |
||
filename |
The name of the file inserted into the container field. |
text |
MD5 |
The result of applying the cryptographic hash function MD5 to a file inserted into the container field or a file referenced by a container field. |
text |
storageType |
The method used to store the data in the container field: Embedded, External (Secure), External (Open), File Reference, Text. |
text |
fileSize |
The size (in bytes) of the file inserted into the container field. |
number |
internalSize |
The amount (in bytes) of the space inside the database file that is occupied by the container field. |
number |
externalSize |
The amount (in bytes) of the space that is stored externally by the container field. This is either the size of the referenced file or the total size of all files in the container field (set up for open or secure storage). |
number |
externalFiles |
A list of the external files associated with the container field (either files using open or secure storage or a file reference). |
text |
Images |
||
width |
A number representing the width of the image in pixels. |
number |
height |
A number representing the height of the image in pixels. |
number |
dpiWidth |
A number representing the horizontal DPI of the image. |
number |
dpiHeight |
A number representing the vertical DPI of the image. |
number |
transparency |
1 if the image has an alpha channel, otherwise returns 0. |
number |
Photos |
||
orientation |
A number representing the orientation of the photo: 1(Normal) 2(Flipped horizontally) 3(Rotated 180 degrees) 4(Flipped vertically) 5(Rotated 90 degrees counterclockwise and flipped vertically) 6(Rotated 90 degrees counterclockwise) 7(Rotated 90 degrees clockwise and flipped vertically) 8(Rotated 90 degrees clockwise) Note: Photos that were inserted using earlier versions of FileMaker Pro are not automatically oriented; for such photos, not applied is appended to the result. For example, 3 (Rotated 180 degrees), not applied. |
text |
created |
The earliest available timestamp for the photo. |
timestamp |
modified |
The latest available timestamp for the photo. If the photo has never been modified, an empty string is returned. |
timestamp |
latitude |
The latitude of the location of the photo. |
text |
longitude |
The longitude of the location of the photo. |
text |
make |
The manufacturer of the camera used for the photo. |
text |
model |
The camera model used for the photo. |
text |
Audio |
||
Note Only MP3 and M4A files return results. |
||
title |
The title of the audio. |
text |
artist |
The name of the performer of the audio. |
text |
album |
The name of the album containing the audio. |
text |
year |
The year the audio was released. |
text |
track |
The track number and count of the audio. For example, 3/12, or 3 if the track count is not available. |
text |
genre |
The genre of the audio. |
text |
composer |
The composer of the audio. |
text |
coverArt |
An image of the album cover. |
container |
duration |
The duration of the audio. For example, 0:03:16. |
time |
bitRate |
The number of kilobits per second (kbps) used in the audio. |
number |
Bar Codes |
||
barcodeText |
The content of the bar code. |
text |
barcodeType |
The type of the bar code. |
text |
Signatures |
||
signed |
The timestamp when the signature was inserted. |
timestamp |
Groups |
||
general |
Attributes listed in the General category above pertaining to the container field. |
text |
audio |
Attributes listed in the Audio category above pertaining to the container field. |
text |
image |
Attributes listed in the Images category above pertaining to the container field. |
text |
photo |
Attributes listed in the Photos category above pertaining to the container field. |
text |
barcode |
Attributes listed in the Bar Codes category above pertaining to the container field. |
text |
signature |
Attributes listed in the Signatures category above pertaining to the container field. |
text |
all |
Attributes in all the categories listed above pertaining to the container field. |
text |
FileMaker Function of the Week: GetContainerAttribute.