Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Container field empty calculation

Featured Replies

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.

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

What does a calc set to GetasText( image container field ) return?

  • Author

It returns my calculation

"image:Previews/" & JobNumberMonthYear & ".pdf" & ¶ &

"image:Previews/" & JobNumberMonthYear & ".jpg"

whether the PREVIEW field has a linked image or not.

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.

I don't think testing for length is going to be useful with a calculated/reference-only container.

  • Author

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 by Guest

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 by Guest

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.