Trouble with conditional actions in rule machine 3.0

@bravenel
I was playing with several conditional actions tonight, and when playing with them I often don't get the option I want in the drop downs. Here is an example, I want to add an if-then.

Don't get too worried, I caused this to happen, but I don't think I should have been able to.

Generally what happened was...
I had 3 if thens I was working on.
if
A
end if
if
b
end if
if
c
end if

It was all going well as I added the conditions in order. Then I think I accidentally deleted the first "end if". I tried to insert one before the next "if", but it wasn't an option. I kept playing around, ended up deleting all the conditions, and now I get the picture above.

Just going to start the rule again. No big deal, but I probably shouldn't have been able to cause that issue.

This is virtually impossible for RM to recover from. It is not a compiler, it isn't treating the creation of actions with an overall compiler-type view of the syntax being created. So yes, if you delete key parts of a script you are likely to create this sort of break.

All I can say is be more careful in how you construct your actions. I don't see us putting in the effort to conquer this type of problem. When you deleted the ENDIF, you broke one of the rules of Actions, namely, there are no nested IFs allowed. But that is exactly what you created.

Makes sense!

Instead of "fixing" it, is there some way to keep people from getting to that point in the first place? Possibly if the "if then" and "end" were always added as a pair, then you had to add the action statements in between? And then it deletes as a block?

But either way, appreciate the explanation and will definitely be more careful when using the if thens.

2 Likes

Adding and deleting as a pair is pretty much compiler-like stuff. It's not built to handle such things. It's not a programming language, it has no smarts. It just puts in what you tell it to put in. It does attempt to prevent you from doing certain bad things, like creating a second IF-THEN in the middle of one. But it's not fool proof. There's a tradeoff to allowing anything to be deleted, and then expecting after deletion that everything is OK. Delete IF-THEN parts at your own risk!

2 Likes

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.