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

Hey all,

i am trying to find out how to get a result from a script - for this test, true / false, but i dont know how.


 

//name of script is recursive add

//script calls self



If [Get (scriptparameter) ≥ 100]

    exit script[]

End If



New Record/ Request

Perform Script ["recursive add"; Paramter: Get (scriptparameter) + 1]

Exit Script [Result: Get(scriptresult)]

 

my goal is to use scripts to test my custom functions but i am trying to figure out recursive scripts & tail recursive scripts . Also how to use the Get (scriptResult) in the correct context.

-ian

  • Author

thing i figured out my question after some more tests;


 

Exit Script [Result: get (foundcount) = 100 ]

 

  • Author

how would this stand in for a recursive call though?


 

Exit Script[ Result: Get ( ScriptResult) ]

 

i guess i just need to write code & test test test huh?

  • Author

anyone?

how to get a result from a script

Use the Get (ScriptResult) function.

my goal is to use scripts to test my custom functions

It 's not necessary to call a script recursively in order to test a recursive algorithm - you can use Loop.

  • Author

Comment; I was going based on a mention by JBante -- He gave me some ideas about scripting before writing your custom function. He can better explain what i am trying to do.. Here is an excerpt from a tweet;


In the example from fmforums, I'd do that Perform Script/Exit Script sequence in place of the self-call by the custom function;

 

Next step after a recursive script call might be Exit Script[Result: Get ( ScriptResult )], to stand-in for the recursive function call.

 

** This was from my original question:

 

ques:

 

i am sorry , but i understand coding in an ide from many years ago. NOw you are teaching me something very new, which i would love to learn.



-ian



Os it just a bunch of "set Variable" statements . loops & calculations?            

 

 

ans:

It's mostly Set Variable [] statements. The Case() becomes an If[]/Else If[] series, the Let()s become a series of Set Variable[], the $variables become $$variables, the ~letVariables become $variables, and the recursive custom function calls become recursive script calls followed by something using Get ( ScriptResult ) — Exit Script [Result: Get ( ScriptResult )] in the case of a tail recursive function.            

 

He doesn't explain himself as elaborately as i would like, but he definately has some good ideas or what i think may be good to adopt if you will.

-ian

  • Author

And JBante's response to the above :

Not every recursive algorithm can be represented as a loop. A recursive script is a more faithful analog for prototyping a custom function

I am not into having a conversation here with a third person in another thread.

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.