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.

Getting more out of an $var: recursion without a CF or a script

Featured Replies

Hi all friends

did you know that you can have recursions w/o CFs and scripts ?

Loop_into__the_field.zip

That's pretty cool.

  • Author

It seems that the max recursion's number is: 356.

So, if the calc is:

Let(

$i = $i + 1 ;

[color:red]$i ^ 5 & If ( $i < EndLoop ; ¶ & Test ; Let( $i = "" ; "" ) )

)

you'll have all the values till 356^5 = 5,718,076,875,776

Another limitation is that it works only into unstored calculations.

( So I think that an UNSTORED calculation works by using its field name, not to keep its content, but to [color:green]evaluate its own calculation )

It seems that the max recursion's number is: 356.

So, if the calc is:

Let(

$i = $i + 1 ;

[color:red]$i ^ 5 & If ( $i < EndLoop ; ¶ & Test ; Let( $i = "" ; "" ) )

)

you'll have all the values till 356^5 = 5,718,076,875,776

Another limitation is that it works only into unstored calculations.

( So I think that an UNSTORED calculation works by using its field name, not to keep its content, but to [color:green]evaluate its own calculation )

Can you please explain the underlined element?

  • Author

If you try my file ( attached to the first post ), you'll see that EndLoop is a field where you can enter the number of recursions.

The 356 limit is limiting, but it's a nice feature for those who don't have Advanced.

Otherwise, I don't see why you wouldn't use a custom function.

  • Author

D J

Yes it is interesting to know but I can't find a real use for it, neither for those that haven't Advanced ( they still have ScriptMaker ).

The more interesting thing that I learn from it is the way FileMaker handles unstored calculation fields.

  • 1 month later...

Hi daniele,

I just looked at this file do to the current thread Here and I'm wondering what the purpose of the calculation is.

If it is to make a list of the alphabet that includes each letter up to the number in the EndLoop, then why does it skip the letter "i", or have I missed something again?

Lee

  • Author

Hi Lee

this is the string that I used in that example: "abcdefghkjilmnopqrstuvwxyz" ( i at 11th position )

but had to be: "abcdefghijklmnopqrstuvwxyz" ( i at 9th position )

Oops, now that you pointed to it, I see it.

Lee

  • 6 months later...
  • Author

from another thread:

For anyone reading this thread, you included, I'd recommend against forcing recursion by referencing a calculation field to itself. Although it might seem to work in some circumstances, it's not possible to predict how it will behave under other conditions. Unlike a custom function, there is no built-in protection against stack overflow and you might easily end up with the application crashing and your file being corrupted.

Hi comment

I wish to go more inside this subject, expecially the ipothetic corruption.

My tests didn't give any crash, even if I do not trap for recursion's number.

My tests didn't give any crash

That doesn't mean it won't crash in other tests. I'm not saying it will, but it's not possible to prove it won't. The only conclusive test possible is one that does crash - but I am not going to try that.

  • Author

I do not think it is right to argue that a certain calculation will fail and will have dire consequences, but without having the evidence.

BTW: At least one advantage: allows you to directly test a future custom function

Let me try and make this as clear as I can:

The "Technical specifications of FileMaker Pro 11 and FileMaker Pro 11 Advanced" state:

Recursion limit for custom function:

1. 50,000 recursive calls total

2. The call stack is only allowed to be 10,000 calls deep at any point.

If these limits are violated, the custom function will return "?".

The specifications do not mention a limit for a calculation field calling itself - so either there is no such limit, or circular reference is not supported. Draw your own conclusion and proceed at your own risk.

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.