WARNING: This post is a bit rough around the edges (and might see some noted edits).
Posting it now "as is" based on a back channel suggestion that just came in....
On a previous post it was stated that (under the hood) the “Set Variable" script step sets an [immutable variable] while the “Insert Calculated Result targeting a $var (available as of FM 16 and up) script step sets an [mutable variable] and therefore, the "insert calculated result” script step is more performant (in some cases) when a $var is being written to more than once, for example in a loop.
It seems as there are a number of use cases to be tested:
- Override a variable with text, replacing the pre-exiting value
- Append text to the end of a variable
- Insert text into a a variable (block of text) using JSONSetElement
- Declaring a variable just once
Here is some background discussion on the first point:
Use "Insert Calculated Result" to concatenate strings! <= Groundbreaking Performance Leap!
https://community.claris.com/en/s/question/0D50H00006dsly8SAA
Posted by @mrwatson-de (https://community.claris.com/en/s/profile/0050H00000Bq7FrQAJ)
Lets dig for more gold!
What are the comparative advantage of “Set Variable” vs. “Insert Calculated Result” targeting a $var (or $$var)
FileMaker 16 and above is required to target a $var or $$var
https://fmhelp.filemaker.com/help/16/fmp/en/index.html#page/FMP_Help/new-features.html
Insert Calculated Result can be faster when a $var is being written to more than once, for example in a loop.
The user interface for “Insert Calculated Result” requires 1 less click to access the calculation engine
There seems to be a gotcha if you run the Insert Calculated Result while your curser is in a field
https://community.claris.com/en/s/question/0D50H00007RPXYDSA5/insert-calculated-result-strangeness
Others?