Help about rules v7-v12

Hallo, I’m new to the community and a new donator.
I need a help to write down a v7 rule the show me the autoconsumpton of my house.
In my opinion should be:

if “power consumption” (v4) > “power generation” (v2) than “autoconsumpton” (v7) is “power generation” (v2)

if “power consumption” (v4) < “power generation” (v2) than “autoconsumpton” (v7) is “power consumption” (v4)

So I’ve wrote the rule: if(v4 > v2) v7 = V2 else v7 = v4
but I received this error: Invalid Rule: Parse error at line 1, column 21. Encountered: else

What is wrong? Please help me.

Andrea

1 Like

Try adding a semicolon to signify the end of the line/statement.

if (v4 > v2) v7 = v4; else v7 = v2;

These rules are very sensitive to what you type. “if(” should be “if (” and “V7” is not the same as “v7”. Spaces are very important.