Conditional statement disappears in Rule Machine

Hi,

I am editing a more extensive rule and added an IF statement before some code since I wanted to validate a condition before executing a bit of the code. I then inserted an ELSE statement and finally and EN-IF statement. When I entered the END-IF statement, the contion in the IF statement disappeared (Please see picture below).

I think it is still there, so to speak, as I was able to press DONE and didn't get any complaints.

If I go in and edit this line it looks like this:

If I select edit it looks like the editor views the line as missing and gives an parenthesis error. But I can see the line that is missing as an existing option to add.

If I then add a parenthesis RM accepts the statement but does now give double statement error. Note that both lines are still missing (Se picture below)

I added the line again and removed the broken condition line and RM accepts this, but the statement is still missing, and a pair of parenthesis appears to have been added.

I got the same error at another location in the same rule earlier but that time, I could ad the same statement again from the list of statements, as I tried to do in the example above, and the statement appeared and all was well. The only difference to the first time the bug occured was that I didn't get the '**Broken condition **' error (Se picture below)

Pleases advice

EDIT: I updated tot eh latest update, 2.3.5.140, but this unfortunately did not solve the issue.

1 Like

Broken condition means one of the conditions are broken. It is probably the one that is blank. Back out and go to the manage conditions section, edit and fix the broken one (It should be below the table that shows the actions that you posted). You may have to then update the if statement.

Edited to add, the broken one may appear as a blank line. You may have to just delete it and add a new condition (It's been a while since I broke a condition.... so going from memory)

Manage Conditions

Hi Tray_e,
Thank you for your thoughts. The main issue is that the line disappearing. That happens first and when it does, there are no broken conditions. I am fairly certain the broken condition is an error due to the line being missing. As you can see, I already did what you are suggesting me to do and remove the broken contion error. The main issue remains.

It's usually the other way around. The line is blank because the condition is broken and filled with a null value.

Again, look in the manage conditions section dropdown for an empty line. That is probably your culprit.

Thank you tray_e. Remember, the issue manifested it self twise, and the first time the statement disappeared, there was no broken condition statement (Se picture below). I.e. the statement went missing without any errors after first having been accepted without any errors. Could that still have happened if the original statment was erroneous?
But thank you, yes, if I add the IF statement again by selecting the the pre entered lines from the first time I registred the statement, that sticks and is a working workaround. But since I am able to add the statement, not by registering it again, but selecting the lines I registered on the first statement that went missing, would that not indicate that the statement was correct the first time it was entered? If it hadn't been, and it was a legitimate error, the line would then not disappear again? I still am curious as to why this happened and I do think the statements were correct the first time they were entered. So I am not entirely convinsed that the lines disappeared due to a broken condition situation.

What did the manage conditions table look like when you posted your first screen?

Not trying to argue. Just trying to help you solve it as it is now. A broken condition is just that. There are numerous things that can break a condition or a rule. Not aware of any that just happen.... Both times I had the issue, it was because I was not paying attention and used the back arrow before updating the rule. I believe it can be caused by deleting a device that relies on the condition or even possibly not having a variable initialized with a value (causing a null condition). I am sure there are others.

While not trying to place blame, the fix would be to find and fix the broken condition or to delete the rule altogether and rewrite it. Since it is not broken to the point you cannot open the rule, it makes sense to try and fix it. Then, you might want to check and see if you deleted a device, or a variable, or made a change and didn't update or click done before exiting the rule. If you rule all of those out, it could just be a DB corruption (although it would be odd for it to be on just one rule).

Thank you, and I am just grateful for your assistance. If it was a broken condition, should I not have gotten that error the first time as well? I did copy and paste quite a lot of lines, and perhaps I added and removed lines without pressing done inbetween? Maybe that stired things up?

The conditions have been unchanged.

Thank you for your assistance.

Back on your original screenshots, what is very clearly shown is a broken condition. All of your attempts to further edit the rule, instead of fixing the condition, made things worse. @tray_e was right in the advice he gave, You haven't once shown the Manage Conditions page, and that is where the problem lies. As he says, there will most likely be a blank entry in the pull-down, and that condition needs to be removed or fixed. Instead of attempting to edit the expression in the IF-THEN (which is not the problem at all), I would suggest removing this action and recreating it.

2 Likes

Thanks @bravenel . I must have done something along the way without realizing it then. Sorry. But I did finally post the manage conditions page in my last post? Is there something else I should have posted instead to clarify the manage conditions?