A SERVICE OF

logo

32 FileMaker ODBC and JDBC Guide
Retrieving the contents of a container field: CAST() function and GetAs() function
You can retrieve binary data, file reference information, or data of a specific file type from a container field.
To retrieve binary data, use a standard SELECT statement. For example:
SELECT Company_Brochures FROM Sales_Data
If file or JPEG data exists, the SELECT statement retrieves the data in binary form; otherwise, the SELECT
statement returns <null>.
To retrieve file reference information (such as the file path), use the CAST function with a SELECT
statement. For example:
SELECT CAST(Company_Brochures AS VARCHAR(NNN)) FROM Sales_Data
In this example, if you:
1 Inserted a file into the container field using FileMaker Pro but stored only a reference to the file, the
SELECT statement retrieves the file reference information as type SQL_VARCHAR.
1 Inserted the contents of a file into the container field using FileMaker Pro, the SELECT statement
retrieves the name of the file.
1 Imported a file into the container field from another application, the SELECT statement displays '?' (the
file displays as Untitled.dat in FileMaker
Pro).
To retrieve data of a specific file type from a container field, use the GetAs function and specify the file’s
type. For example:
SELECT GetAs(Company_Logo, 'JPEG') FROM Sales_Data
The possible file types (case sensitive) you can retrieve from a container field in a FileMaker database file are:
File type Description File type Description
'EMBO' OLE container data 'PDF ' Portable Document Format
'EMF+' Windows Enhanced Metafile Plus 'PICT' Mac OS (does not have 512-byte file-based header)
'EPS ' Embedded PostScript 'PNGf' Bitmap image format
'FILE' Result of an Insert File command 'PNTG' MacPaint
'FPix' Flash (FPX) 'qtif' QuickTime image file
'FORK' Resource fork (Mac OS) '.SGI' Generic bitmap format
'GIFf' Graphics Interchange Format 'snd ' Standard sound (Mac OS raw format)
'JPEG' Photographic images 'TIFF' Raster file format for digital images
'JP2 ' JPEG 2000 'TPIC' Targa
'META' Windows Metafile (enhanced) 'XMLO' Layout objects
'METO' Windows Metafile (original) '8BPS' PhotoShop (PSD)
'moov' Old QuickTime format (Mac OS)