I could probably test this out, but I figure one of you know this off the top of your head!
Are variables set in the LET function created sequentially so I could, say, use the first two variables as part of the third's?
Yes. In fact, this is a good practice.
Beat you to it... just wrote a formula, and the answer is "yes."
Oops, I see I did have and answer! I'm considering how I can use the Auto insert calculated value formula to format phone numbers, but to a higher degree... strip off any leading 1, add the local area code if there isn't one, format the number correctly, add extension if there is one, and include any post-text: "cell", "work", "wife", etc.
I'm sure it's been done, but figuring out how to do this in a single formula sounds like a fun challenge to me!
The reason this is a best practice is twofold:
First, it can make the calculation vastly more readable and easier to troubleshoot.
Second, it means FileMaker only has to evaluate a given expression once, which makes it more efficient. The calc will perform better.
Have fun experimenting!
Not saying that this is a good idea, but you can even re-use the let variables inside the same Let function call:
Let ( [ x = 5 ;
x = x + 2 ] ;
Is valid syntax.
It's like a hall of mirrors... you're blowing my mind...
They're good, as Mike pointed out to allow FM to evaluate a calc, such as Get(CurrentDate), only once.
They're also great for taking a long field name such as: ThisIsMyTable::The_FieldName_Thats_Long and set it to a variable:
_field = ThisIsMyTable::The_FieldName_Thats_Long
Almost everywhere calculation is done left to right, but aggregate functions do it right to left (found no document).
results 4, not Average(3;9) but Average(5;3)
I found this past on List(), but now tested on FM16v2 Min(), Max(), Sum() and Average() also behave same.
Interesting! Thank you user19752. Yes, please test on all the aggregates and report back.
Retrieving data ...