Editing Expressions with Parenthesis (Double Operator Error)

@bravenel, I believe I found a bug in the Edit Expressions feature that was recently added to Rule Machine. When editing expression in Rule Machine, if your expression has a parenthesis, followed by an operator (and/or) this will error giving you the error "Double Operator". The following screenshot was captured immediately after entering "Edit Expression".

You can see that the error is posted saying "Double Operator", preventing me from saving the expression and continuing on. This occurred without actually changing anything using the Edit Expression. As soon as you click edit expression, the error is posted. In fact, I can only save the expression if I delete both parenthesis OR the OR!!

So, if I remove the OR, making the expression incorrect, I can save it. This never errors out at all and allows me to save the rule. I believe that the parenthesis needs to be excluded from the "Double Operator" error and instead error out if there ins't an operator immediately following one.

As a side note, when building a rule, RM correctly REQUIRES you to have an operator after a parenthesis. So, looks that that is correct.


(And by the way...try to say the word "parenthesis" without a sibilant s. It's not easy!! :wink: )

I've seen this as well but thought it was me. :slight_smile:
I just erased the expression and redid it to get round it.
Be nice to have a fix in case I come across it again.

Thanks. I assume you're talking about a right paren. The error was supposed to be for ( OR
not for ) OR

I'll put in a fix for that.

1 Like

Correct. Obviously ( OR would be incorrect. The issue is with the right or close parens. The "rule builder" has it correct and doesn't allow you to pick an operator after an open parens and requires you to pick an operator after a close parens.

Thank you! Most of the time when I want to edit an expression it's when there's "parensing" involved.
Otherwise I find it easier to just erase the expression and re-do it rather than risk screwing it up completely blowing away my whole rule. So, I appreciate the fix.

Fix is in. Next release.

Also, wrt a request you had made some time ago, RM is getting an action to set a string variable from the response to an http GET. May do the same for response to http POST.

Thank you muchly.

Actually the request was for unsolicited HTTP Get messages sent to HE to be parsed. For example, when an IFTTT applet triggers and wants to send data for a Google Calendar Event to HE. I figured out a messy way to handle it, by basically parsing the parameter field in the Maker API with my own sub-field delimiters sent to a custom driver. But now that the maker API can accept more than one parameter, this is will be a LOT simpler. But I'll definitely take a look when it comes out when the new version comes out. So far building custom drivers to handle simple HTTP Get requests has been a lot less labot-intensive for the hub so I've just been writing a whole bunch of them for myself.

Show me an example of what the endpoint looks like. Was your idea to be able to grab the parameter(s) of the GET and be able to use it as a string in RM? That would be fairly easy to add, but it depends on the format used. The easiest one would be /apps/api/16924/trigger/PARAMETER?auth-token. The easy thing to do would be to put PARAMETER in %value%.

This error is driving me nuts. I'm glad it is going to be fixed. Is thier a way to make my AND'd OR's work short of three differant rules?

I'm not really sure what you mean about the error. Your not actually using parenthesis in your expressions.
I assume you want 3 sets around the x AND y expressions seperated by the OR.

Yes. When I use ((and)or(and)or(and)) I get the errors discribed in this tread. Running the rule as picturedabove doesn't work, it needs the (()()()). Does that make sense?

Ah OK. Makes perfect sense.
When I had that issue I went into edit, selected the expression, erased it and re-input it and it took OK.
I know this is far from ideal but have you tried that?

Reinput it with ( )?

That's exactly what I was thinking. My endpoint looks exactly the same except it's from the maker API and instead of "trigger" I have a command I've built into the driver. Throwing that into %value% would be perfect. Then you can always use the token function to parse it out if you wanted to. Sounds like it would work perfectly.

An example URL that I have used to pass unsolicited info to HE is something like this:

Now that you can pass multiple parameters off the maker API in one function, I'm in the process of moving that last webCoRE piston I have that does this into a custom driver. But adding this to RM would allow HE to react more easily to outside stimuli.

then first expression
second expression
) OR

Hope that makes sense. :wink:

The issue is only present when trying to edit an expression. When writing the rule from scratch or after hitting "Erase Expression" there is no error. RM requires that you input an operator after a close parens and prevents an operator after an open parens, just like it should. So, if RM isn't giving you the option you want, you're picking the wrong option.

But you will not be able to edit the expression to add the parents in until the bug is fixed. I recommend you hit erase expression and then rebuild the expression one statement at a time. You just have to pick them from the drop down menu.

I'll give it a shot, thanks.

1 Like

I already did it. Next release.

Cool. I'll take a look when it comes out.

This is not true for me, I have tried building these actions from new and editing and after erasing. When built from newit does not run.

What do you mean, does not run? I'm telling you that the issue I reported does not present itself when you are creating a new expression. If you are experiencing a problem when creating a rule, it is not related to what I reported.

Can you provide a screenshot of what you have created? Because the screenshot you posted above doesn't have any parens in it all, so I fail to see how parensing could be a problem.

As a side note....do you think it could POSSIBLY be you and not the software? Just goin out on a limb here but I tend to think it's my fault before I start blaming a system that I am unfamiliar with. So, rather than just try and pile on, why don't we take a step back and take a look at what you're trying to do.

Did you follow the steps that @bobbles wrote up? If so, what was the outcome? Can you post a screenshot of it?