Page 1 of 1

If Do without Else If Do does not work

Posted: Sunday 21 June 2020 22:36
by AlanGpio
Just some heads up that using an If Do with the blue config icon but not setting the Else If Do fails to work.

This situation may arise where a user selected the If Do with Else If Do and then changed their mind and decided the Else condition is no longer needed; or where there was an If Do with and Else If Do and then the Else If Do gets deleted.

Example:
If Do without Else If Do.jpg
If Do without Else If Do.jpg (34.22 KiB) Viewed 482 times

Here is an example with an Else If Do that works
If Do with Else If Do.jpg
If Do with Else If Do.jpg (60.1 KiB) Viewed 482 times

I'm new to Domoticz and the Blockly feature is a quick way to write rules and quick to assimilate when revisiting some months later. But it's a bit frustrating that the If Else does not follow normal programming logic (yes, I've seen the posts) and that If Else's cannot be nested (ditto).

Looking at the Blockly website https://developers.google.com/blockly I see the main stream Blockly has some nice features like loops, mathematical functions, text functions, Lists and sub-functions. Dream on ;)

Re: If Do without Else If Do does not work

Posted: Monday 22 June 2020 6:25
by Egregius
Why use a else if block if you don't need the else? Then use a if block.

Re: If Do without Else If Do does not work

Posted: Monday 22 June 2020 9:22
by felix63
@Egidius The key is in the prase 'and then changed their mind '

Alan, Thanks for sharing your tip!