Thanks, but I have followed that link and more. It basically resolves to either a plugin (does not support mac) or a script to load a file and test for an error that takes much much tool long for tens of thousands of records. I had hoped for something as simple as isvalid(field) but no joy there. This work is for a non-profit animal rescue group so purchasing costly plug-ins is not an option. Thanks for the response.
I don't think you need to "load a file" to see if it is there. You may need to use either AppleScript or a free plug-in to see if it is there. The MooPlug on Windows can do this, the ScriptMaster plugin, from 360Works can do this cross-platform (it's in their example file, and is pretty simple). None of these are hard to do, none of them open the file first, so all of them are fast.
The only catch is that they require an OS syntax file path, not a FileMaker syntax one (which is what the container contains). So you'd need to parse it out, and remove the FileMaker prefix ("file:", "filemac:/", "filewin:/" or "image:", etc.).
On a Mac, you can use either "vanilla" AppleScript or a Unix shell command. Basically it depends which syntax path you want to figure out. You could do that either in FileMaker itself, as an unstored calculation, or on the fly in the Perform AppleScript step.
The following would run in a Perform AppleScript step. You would need to pass it the container's FileMaker syntax file path (I just hard-coded it here). It will throw an error if the file is not there, which you can use Set Error Capture ["On"], then Get (LastError) to capture:
There is a commented line which you'd use instead, in hosted files situations, where the paths are different.
set fm_path to "filemac:/Macintosh HD/Users/fej/Downloads/vlc-1.1.5.dmg"
-- hosted files; strip 'file://', add '/Volumes/' to create a POSIX path
-- set posix_path to ("/Volumes" & ((characters 7 through -1 of fm_path) as Unicode text))
-- not hosted; do the offset of "/" twice, to remove the FM prefix, then the drive name
set off_set to (offset of "/" in fm_path) + 1
set path1 to (((characters off_set through -1 of fm_path) as Unicode text))
set off_set to (offset of "/" in path1)
set posix_path to (((characters off_set through -1 of path1) as Unicode text))
do shell script "test -e " & quoted form of posix_path
I need this feature for my application also. I am not familiar with AppleScrip. Can you post the result of posix_path and entire shell script for "not hosted" case?
"I have a database with over 20,000 records which has only 400 records with photos to display. Using a calculation to a file path for a jpeg image works fine and displays the image when necessary."
This is the part i'm stuck on. I'm trying to get FM to show an image based on the content of a field. For example: if the gender is M, show picture A and if the gender is F, show picture B throughout the database.
I've only had FM for two weeks so I'm incredibly new to this. This seems like a simple enough function, I just have yet to figure out how to do it.