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.

Featured Replies

Hi all,

Is it possible to do a loop within a calculation (in Define Fields)

OR

to call a user-defined script from within a calculation?

Each record has a set of related records. I want to define a calculation field displaying a particular related record if and only if it meets other criteria as well. Right now I have a calculation which looks really ugly (I am inexperienced with FileMaker scripting please don't yell at me!):

If (GetNthRecord(Foo::Bar;1) = "Criterion"; GetNthRecord(Foo::Foo;1); "") &

If (GetNthRecord(Foo::Bar;2) = "Criterion"; GetNthRecord(Foo::Foo;2); "") ... etc

I couldn't figure out a way to lookup a related record from the list of related records based on the value of one of its fields (not the field that creates the relationship, and i don't want to make another occurrence of the table in the relationship graph) so this was the next best thing I was able to get going. There is probably a better way.

I'd be happy if I could just do the above, but with a loop. If not a loop in the calculation itself, perhaps by calling a script.

Recursive calculations are possible within custom functions - but you need the Advanced version for writing/installing custom functions.

Another option is to use a repeating calculation field - see:

http://fmforums.com/forum/showtopic.php?tid/137788/

In an aside to comment, I'll chime in that this kind of logic would be better implemented with a CustomFunction... keeps things more sane when you (inevitably) have to come back to it.

  • Author

If a database is created with Advanced, can it be used (custom functions and all) on the regular version of FileMaker Pro?

I think I will just do all my "loop" iterations by hand for now; it's not a big deal in this case. Thanks.

(I tried to get it to work by doing a Calculation Repetition, but this ended up making my field a repeating field, which wasn't exactly a desired effect.)

Thanks guys.

If a database is created with Advanced, can it be used (custom functions and all) on the regular version of FileMaker Pro?

Yes.

I tried to get it to work by doing a Calculation Repetition, but this ended up making my field a repeating field, which wasn't exactly a desired effect.

You could use List ( RepeatingField) in a second, non-repeating calculation field.

EDIT: Well, you could - if you had version 8.5 or higher.

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.