[2.4.0.145 C8 Pro] Can't insert "ELSE IF" into Rule 5.1

I'm trying to add another "ELSE-IF" branch to a rule (5.1) but it doesn't seem to recognize that it's in a series of ELSE-IFs where that is allowed (note: This is copied from the middle--there's a proper "IF" at the top):

@bobbyD Any thoughts?

1 Like

Is there more to the rule prior to the lines you shared in the OP? I ask because, syntactically, one normally starts with an IF statement and then adds ELSE-IF’s, whereas you are starting with ELSE-IF. I can’t say that’s the root cause problem, but it’s the first thing that jumped out at me.

Hope this helps.

Yes, there's a bunch more to it (but it wouldn't fit in a screenshot).

It starts with a proper "IF"--and the rule works perfectly.

Just that editing it, now, I have to copy & paste the "Else-If" and "End-If" in there. That didn't used to be a problem.

1 Like

C-8 running v2.4.0.145.

I had the same problem trying to add an "ELSE" into an if-then-else-end-if. I had to add the ELSE as the last action in the rule and then move it up. This used to be possible. But the only actions available are If-Then and Simple. This is reproducible.

2 Likes

I'm pretty sure the issue is that you have a complete If/End If statement, and the ELSE options only appear when your statement is not completed by the END IF.

I don't know if it always worked that way or is a recent UI change. It makes sense that the ELSE and END IF options disappear from the bottom of the table when there isn't an open statement.

Did clicking the + signs between the IF and END IF previously offer the option to insert an ELSE inside a complete statement?

The Else and End statements at the bottom aren't the issue.

The issue is, there isn't ANY way to insert an Elseif into a rule. That used to work.

Yes. Clicking the + sign between and IF and an END IF and selecting "Conditional Actions" used to give the entire list of possible conditional statements: IF THEN, ELSE, ELSE-IF, END, and Simple. ELSE can be added at the bottom of the code and then laboriously moved up. But there's no way at all to add an ELSE-IF.

I can think of two reason off hand that removing this does not make sense:

  • No code is static. There's always the need to be able to modify code that is either not working as intended or needs to handle a new or changed set of circumstances. Modification may include changing conditional statements, and those statements may need to be made more complex.

  • Personally speaking, if I'm adding an IF into the middle existing code I almost always immediately add the END-IF as well. That keeps statements in/out-dented appropriately and, given the rather "interesting" nature of the Rule Machine GUI, makes it easier to see where I'm at and what I'm doing.

4 Likes

@bobbyD I reproduce it with a simple test case.

It seems that any time you have a "nested" IF-THEN-ELSE, you can't insert conditional statements into it....

1 Like

See my screen shot above. You can't insert ELSE or ELSE-IF into any conditional statement. it doesn't have to be nested.

2 Likes

I'm seeing the same problem. I'm trying to insert an ELSE-IF to convert an ELSE. Can't do the insertion above or below the existing ELSE.

Let's see if this issue persists into .147:
Starting with a fresh test rule, begin composing an IF-THEN block...


...try introducing an ELSE-IF subblock:

...which succeeds, so add an END-IF to complete the working rule:

Next, attempt to introduce a second ELSE-IF subblock, by clicking the [+] on the last row, then "Conditional Actions" > "ELSE-IF expression THEN":


which also succeeds.

Likewise, I was able to include an "ELSE" statement in situ without needing to add it at the end and move it up:

Does this suggest the OP issue has been fixed? Or have I overlooked something for this test.

I'd like to know your secret, because it's not working for me.

Not sure where we diverge, but will add:

  • I'm using Chrome (latest) web browser on Win11
  • My hub is a C7 running 2.4.0.147

Beyond that, we'll have to investigate deeper.

I usually use Safari, but tried Chrome with the same results.

C8 running 2.4.0.147.

I thought maybe with a brand new rule that had never been changed it might work, and then stop working once the actions were saved. But that proved not to be the case, either.

I'm out of ideas.

UPDATE: I can now definitively replicate what you're seeing! I returned to the same rule and began editing it in an attempt to add more ELSE-IF statements, and every attempt failed exactly as it has for you.

Racking my brain now on what's going on.

EDIT: So far, all signs point to the presence of an ELSE, suppressing ELSE-IF in the conditionals drop-down list. During further testing, when I remove ELSE, I once again get the opportunity to insert ELSE-IF. But even that is not happening 100% of the time. So back to the drawing board.

I think it's time to summon @bravenel on this unusual case, Commissioner Gordon.

2 Likes

In the little test rule I made above there's no ELSE in the original. But I still can't add an ELSE.

If I remove the END-IF, then I can insert an ELSE or and ELSE-IF anyplace in the rule. So I think it has something to do with the IF / END-IF being seen as "complete". Or something like that.

But obviously removing the END-IF is only a solution if it's the last thing in the rule. If we're talking about an IF / END-IF further up in a complex rule with other conditionals, then it's not really workable.

2 Likes

I swore that I tried doing just that, and still couldn't add ELSE or ELSE-IF during one of my trials. Maybe I forgot to click UPDATE RULE or some other intermediate step...

But yeah, the more I repeat the way you did things – just by removing END-IF – the clearer your conclusion becomes: No ELSE or ELSE-IF offered.

As a counterpoint, this rule with a 'completed' IF-THEN-ENDIF does allow me to place an ELSE or ELSE-IF:


but the moment I've included an ELSE, no more ELSE-IF available:

...even if I first delete the END-IF, which I think still comports with your OP's facts.

Yes I can reproduce that.

1 Like