a simple example of my gnarly IF THEN ELSE problem (bug?)
Posted: Sun Jul 23, 2023 6:45 pm
I notice over 40 views of my original post, but not one reply. I've continued to dig around, and the problem is looking more like a bug than user error to me, but of course I'm ready to stand corrected if this is simply a "you forgot to put a comma here" problem.
Here's a really simple model that I think illustrates the issue. I've attached the model (testIF.mdl).
It attempts to calculate an outcome variable [result] from 4 simple input variables, a=1, b=2, c=3, and d=4.
I only get three attachments, so you'll have to open the attached model to see the View.
Here's the equation for {result]. This is the same logic as in my original post, but with simpler variables so the structure is clear: As can be seen at the bottom, when I "Check Syntax", I get the same "Expecting an operator" error.
I figured it must have something to do with those IF statements, maybe I wasn't doing the :AND: logic correctly.
So, I created [result2] by doing a copy-paste on [result], modified it (deleted the inputs from a and b) and removed all the IF THEN ELSE statements . Certainly that should work.
Here is the [result2] equation. It's [result] stripped down to one operation: Yet, this simple equation (can't get simpler!) also fails with the "Expecting an operator" error. I thought maybe duplicating [result] had carried over some hidden code to [result2] that somehow stuck around after I deleted all the IF statements. To test this, I deleted [result2] and added it back into the model as a fresh new variable, setting its equation to the same simple 100 followed by c * d. Got the same result, "Expecting an operator".
I hope this example makes the issue clearer than in my previous post.
Here's a really simple model that I think illustrates the issue. I've attached the model (testIF.mdl).
It attempts to calculate an outcome variable [result] from 4 simple input variables, a=1, b=2, c=3, and d=4.
I only get three attachments, so you'll have to open the attached model to see the View.
Here's the equation for {result]. This is the same logic as in my original post, but with simpler variables so the structure is clear: As can be seen at the bottom, when I "Check Syntax", I get the same "Expecting an operator" error.
I figured it must have something to do with those IF statements, maybe I wasn't doing the :AND: logic correctly.
So, I created [result2] by doing a copy-paste on [result], modified it (deleted the inputs from a and b) and removed all the IF THEN ELSE statements . Certainly that should work.
Here is the [result2] equation. It's [result] stripped down to one operation: Yet, this simple equation (can't get simpler!) also fails with the "Expecting an operator" error. I thought maybe duplicating [result] had carried over some hidden code to [result2] that somehow stuck around after I deleted all the IF statements. To test this, I deleted [result2] and added it back into the model as a fresh new variable, setting its equation to the same simple 100 followed by c * d. Got the same result, "Expecting an operator".
I hope this example makes the issue clearer than in my previous post.