JGP Posted November 19, 2008 Share Posted November 19, 2008 I've got a calculation field (result container) to present a preview of an image file. Field name PREVIEW. Script = "image:Previews/" & JobNumberMonthYear & ".pdf" & ¶ & "image:Previews/" & JobNumberMonthYear & ".jpg" This all works fine. I wanted to create another calculation field (called EMPTY) to let me know if the PREVIEW field is empty (in other words there was no file for the PREVIEW calculation to link to) so that i could do a find based on this result and then create these image files. At the moment, when there is no image showing in PREVIEW it shows the text "The file cannot be found:1115-08". I have tried a lot of calculations without much joy and can't find any similar problems on any forums. Appreciate any suggestions. Link to comment Share on other sites More sharing options...
Fenton Posted November 19, 2008 Share Posted November 19, 2008 There is (to my knowledge) no native calculation that can tell you whether the file actually exists or not. Some of the plug-ins can do this. I know Troi File can. But that's kind of expensive overkill for just this problem. On a Mac you can find out fairly easily with AppleScript. That attached file shows two different ways to do that. One is to write a calculation that produces the AppleScript, the other just uses a regular AppleScript. Both run via the Perform AppleScript step, and write the result to a field in the current record. Either can be run in a Loop, to do the found set. File_Exists.zip Link to comment Share on other sites More sharing options...
Vaughan Posted November 19, 2008 Share Posted November 19, 2008 What does a calc set to GetasText( image container field ) return? Link to comment Share on other sites More sharing options...
JGP Posted November 19, 2008 Author Share Posted November 19, 2008 It returns my calculation "image:Previews/" & JobNumberMonthYear & ".pdf" & ¶ & "image:Previews/" & JobNumberMonthYear & ".jpg" whether the PREVIEW field has a linked image or not. Link to comment Share on other sites More sharing options...
normanicus Posted November 19, 2008 Share Posted November 19, 2008 Well, you can't actually test if it exists natively in Filemaker but you can test if it has zero length - which is probably good enough. Link to comment Share on other sites More sharing options...
comment Posted November 19, 2008 Share Posted November 19, 2008 I don't think testing for length is going to be useful with a calculated/reference-only container. Link to comment Share on other sites More sharing options...
JGP Posted November 20, 2008 Author Share Posted November 20, 2008 (edited) Yep i tried to test the length but it returned "0". If i convert the "calculation/reference field with result container" to a "Container field with a calculation" it returns a length result but doesn't link to my referenced files on the fly. I'm not all that familiar with AppleScript but will give Fentons idea a go. But will keep checking back if anyone else has any creative ideas. JP Edited November 20, 2008 by Guest Link to comment Share on other sites More sharing options...
comment Posted November 20, 2008 Share Posted November 20, 2008 (edited) I would go with Applescript. Another option is to go the Previews folder, select all, copy and paste into a text editor. Then import this into Filemaker and relate it to your existing table. This too could be automated, either by Applescript alone or a combination of Filemaker script calling an Applescript. Edited November 20, 2008 by Guest Link to comment Share on other sites More sharing options...
Recommended Posts
This topic is 5774 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 accountSign in
Already have an account? Sign in here.
Sign In Now