Jump to content

This topic is 5495 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I have a database of photagraphs in FM10. Some of the photos are on my hard drive, some are on an external hard drive. A link to the photos was imported but they are not stored in the database. If the external hard drive is not present instead of the image, the container field reads: 'The file cannot be found:' followed by the name of the file. I would like to be able to filter the records to create a found set of only those photos currently available, that is, only those on the hard drive if the external hard drive is not present.

I've tried various different ideas within a calculation field, things like isempty and referencing the container field and showing the result as text. All the records return 1 for isempty, regardless of whether the photo is currently available. For the second idea the records all just give the address of the image, even if it isn't currently available.

Any help would be greatly appreciated, thanks.

Posted

if you define a calc text field that simply says:

= containerField (you container field here of course)

Then look at the result of that for a record with a picture in the container and one without.

I think you'll be able to use the result of that...

Posted (edited)

Option 1:

(a) define a calc field to show the container as text.

(:) Write a script that searches on the text field for the name of the hard drive and includes or excludes found records on an ad hoc basis.

Note that this isn't smart enough to detect whether the hard drive is there, but gives you almost the same functionality.

Option 2:

Use a script (triggered on record load) that uses Applescript to check whether the referenced file exists. See my posts in this thread: http://fmforums.com/forum/showtopic.php?tid/211611/post/342555. You could add a script step that excludes the record if the result of the Applescript is that the reference is missing.

Note that this option works on a record-by-record basis. To exclude all records with a missing reference, you will have to loop through the entire database, which maybe isn't what you want.

Option 3: Some combination of the above. An Applescript checks to see if the hard drive is mounted, then (depending on the result of the Applescript) a search on the text field excludes or includes records from a given hard drive. I'll try to upload a demo later.

Edited by Guest
fixed a typo or two
Posted

Wim,

Thanks for your reply, sounds like it might work perfectly.

I have created a new calculation field, set the calculation result to 'text' and then written ContainerField(image), where 'image' is the container field containing the photos. When I press enter it unfortunately says 'This function cannot be found'. Not sure what I've done wrong. Thanks.

Posted

The result of your new calculation field should just be the name of the image field without the "ContainerField(" preceding it and ")" following.

Posted

Setting the calculation to equal the container, with text output, gives the file path but doesn't appear to change depending on whether the file is available.

Posted

Thanks for that. Option 2 has worked well. It takes rather a long time to go through the photos one by one but I've written a script and tweaked the AppleScript so that instead of checking individual files it checks folders and that's much quicker. Thanks for your help and for the example file. Extremely useful. Cheers.

Posted

Thanks, and glad I could help.

Once you are already using Applescript to check whether the hard drive is present, I think you would be best off doing a Find on the filepath (Option 3) rather than cycling through records. Just a thought.

This topic is 5495 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.