Does FMP 18 Evaluate() Handle More Complex Expressions?

In FMP 16, trying to “evaluate()” either of these two relatively simple expressions gives you the dreaded “?”. I wrote a micro-service method which uses a custom PostFix parser to work around this issue.

Just wondering if FMP 18 fixes or expands evaluate() at all.

Here are two examples FMP 16’s evaluate crashes on (meaning…"?")

( ( ( ( 7123 + 93*(8*(1+22-(744)) ) + (100+6) 2.3 ) * 3 ) * 4 (3(2-1) +10) * (8*(2+5)) - (22 * (4-(322))) * (77 + (123(5+99-(7*(2*44)))))

( ( ( ( 120 + 80*(8*(1+22) ) + (100+6)* 2.3 ) * 3 ) * 4 (3(2-1) +10)

I was able to get (confirm) the same results to both these expressions using:

  1. My REST service’s post-fix logic.
  2. Standalone PCalc calculator
  3. A Java IDE “evaluate” variable dialog

(Note: Apple’s calculator “gets” results for both the examples above, but they’re both incorrect.)

The Mac program “Soulver” gets nothing at all for these two expressions.
Just wondering.

Below is my FileMaker 16 program which makes calls to the REST service for these expressions (to “work around” FMP’s Evaluate()). My logic checks for incorrect parentheses nesting and gives a real error (NEVER a “?”!) See the first example’s error. The error is a bit terse and I should revise it to something more user friendly, but this was just an example of giving an error actually returned by the underlying logic.

But, most important of all, the correct result is achieved in every example.

1 Like

There is ambiguity in that expression that you need to clear up. There appear to be operators missing at some points.

(100+6) 2.3
4 (3(2-1) + 10)
123(5+99 …

and in the second equation

4 (3(2-1) + 10)

Which operators are missing in those examples?


It was actually just a PASTE/Save problem on the forum. If you look at the screenshot, all the operators are there.

Something I don’t understand about this forum, I guess. I PASTED the formulas and the operators where there, but after “Save Edit” some operators were missing (in the forum message, not in the screenshot).

I tried to upload a text file with the same expressions you see in the screenshot, but the forum will not allow me to upload a simple text file (or at least drag and drop gives me an error that text is not one of the allowed types).

If you post your email, I’ll email you the text file.

Otherwise, without all the operators, the other three programs would not have been able to get the correct result as they all use post-fix behind the scenes (operator priorities, etc.)

FileMaker 18???


Update on Soulver: developer agreed that my report to him was a bug in the new Soulver 3 (which uses a new math engine) as he got the same results I did using the older version. He will have a fix for Soulver 3 shortly.

FileMaker 18???

FMPA v18.0.1.112

( 7123 + 93 * ( 8 * (1+22- (7*44) ) ) + (100+6) *2.3 ) * 3

* 4 * 
( 3 * ( 2 - 1 ) + 10 ) 

* ( 8* ( 2+5 ) )

- ( 
	22 * ( 4-(3*22) )
	* ( 77  + ( 123 * ( 5 + 99 - ( 7 *(2*44) ) ) ) )


= -1873819311.2

Which is exactly the same as I get from bc on the command line

  => echo "( ( ( ( 7123 + 93 * ( 8 * (1+22- (7*44) ) )  + (100+6) *2.3 ) * 3 ) * 4 * ( 3 * ( 2 - 1 ) + 10 ) * ( 8* ( 2+5 ) ) - ( 22 * ( 4-(3*22) ) * ( 77  + ( 123 * ( 5 + 99 - ( 7 *(2*44) ) ) ) ) ) ) )" | bc


1 Like

Should be allowed I’ll check.

I did not want to put * because I don’t want exe and such so I put .txt .fmp12 .pdf .doc .rtf
did i forget something?

I get -1873819311.2 in 16, 17, and 18…both as a straight expression, and using Evaluate.



Seems the two extra leading parentheses confuse FMP.

I removed them and it works.

It therefore seems the micro-service logic I wrote (about 400 lines) is more robust and less finicky than FMP as it works with (or without) those extra "(("s. PCalc and the Java IDE’s expression evaluator are also robust this way. Plus the micro-service logic returns actual error info if encountered. Never a “?”.



I think the file had a “text” extension perhaps.

evaluateTest.fmp12 (180 KB)

(Or by adding an additional two additional parentheses at the end like you did)


This forum is great!

Love the discussions.


Different languages do different things. You could call “finicky” a strength.

And, depending on the way in which you’ve obtained the “?” you maybe able to evaluate the error to get a message. Can’t promise anything there as I haven’t tried it. Finally, returning an “?” is documented behaviour, so you can test for it.

The “?” comes when FMP isn’t robust enough to handle, in this case, the extra parens. Sorry, no strength there. Instead, IMHO, probably lazy programming/testing by FMI and, again, probably not using standard techniques (like a stack). But, actually, I have no idea since FMP is totally opaque. Full disclosure: I use open source software for most of my programming projects.

Regardless, a program should never give a totally unhelpful output like “?” to the user. Such an output conveys no information. That output is as bad as the old microsoft dialogs that give you an error and then force you to click an “OK” button. (No, it’s NOT ok that your program crashed.)

I would recommend the developers at FMI read Code Complete, About Face, and books like that.

In any case, the micro-service approach works with all my other apps, not just FMP. And it’s FAST, free, works with any number of users, cross-platform, works with any OS, from anywhere, etc. That’s a strength! :slight_smile:


I don’t see it as a weakness. There is no reason for FM to handle erroneous parens. FM is very helpful in telling you exactly where the problem is if you put that expression in the calc dialog.

Also, if you throw an EvaluationError ( ) around the expression, if will return the error FM is generating.


No worries. I understand and respect your position.

I do like the fact that FMP highlights parens problems, but …

1. Using standard techniques, extra parens don’t matter: they’re ignored.

2. Also, a customer using a FMP layout to enter ad-hoc expressions won’t have the “EvaluationError()”; they’ll just get a “?”.

So, it’s really what you consider “robust”.

Even simple products like PCalc get it right with extra parens, but I believe that developer is using standard programming (hello stack!) techniques.

I don’t use Evaluate() at all since the micro-service gives me full access to what is going on. It’s my code. It’s been tested and works every time. No surprises. No “?” – the micro-service logic generates a usable error, if any, for the user.

Yeah, I understand what you mean. Typically, most stuff I’ve used is sensitive to parens being balanced. I probably wouldn’t complain if it did handle it fine, but either way the customer/user is never going to see that. As the developer, I would make sure they don’t see it. It’s, as we both know, pretty easy to guard against that result and return an error if needed.

Exactly. Using standard postfix techniques guards against the extra parens problem. I seriously wonder what the FMP code looks like as I’ve wondered about many of their functions.

The problem is letting the user enter ad-hoc expressions in a field and evaluating them. To “guard” against the result is just using a standard postfix parser (or standard techniques)… :slight_smile:


Agreed. Having trouble seeing how that relates to FM not being robust. Personally, I prefer that they don’t handle stuff like that for me. It takes the black-box-iness to the next level, and how they would handle is definitely not the same as I would handle it far too often.

We just might think about what robust means differently.

To me, it means, at least partly, that the program should generate results, if possible and not get bogged down with minor input errors.

For example, using my ‘evaluate’ code (which I control, not FMI), …


(((1) +(((3)))) Works
(((1) +(((3))))) Works
((1) +(((((3)))) Works
((1) +(((3 Works
((1 +(((3 Works

Other examples work also.

No “?” at the slightest infraction with zero helpful error information. The constant onslaught of "?"s in FMP is a huge fail also. No local error handling is partly to blame since you have no control over what FMP does, or any way to extend it (in an OOP sense), when one of it’s strict methods barfs.

However, using my logic, it is possible to get something that doesn’t work as you see from my screenshot above, but using standard techniques (hello stack!) the code gets most of it right. To wit, the user is rewarded with answers, not "?"s being heaved at them. As long as the parentheses don’t change the precedence of operations, I’ve always gotten the correct result (assuming no error).

Of course if the user “mis-parenthesizes” an expression with valid but logically wrong semantics, there’s no way for any program to know that.

So, you may not agree but I believe that software should be ROBUST in this way. That’s what clients expect.