ELSE IF / THEN - Unable to add new statements


#1

1) Give a description of the problem
Unable to add new statement after ‘then’. I am only able to add one.

2) What is the expected behavior?
Excpected all 3 ‘else if’ ‘then’ statements to work properly.

3) What is happening/not happening?
Unable to choose ‘Action’. Nothing happen when I press the button. Unable to copy/paste, also duplicate and drag/drop doesn’t work.

4) Post a Green Snapshot of the pistonimage

5) Attach any logs (From ST IDE and by turning logging level to Full)
Not related to this problem AFAIK.

REMOVE BELOW AFTER READING
If a solution is found for your question then please mark the post as the solution.


#2

Instead of using the else if blocks, use separate if blocks for each button pushed.

If
Button 1 is pushed
Then
With blah blah
Do
Blah blah
End do
End with
end if

Repeat for each button


#3

Thanks jkp.

I’ll try that. Still thinks that using ‘else if’ should work.

Regards
Mads


#4

You can use a select case statement if you have many IFs and want to really clean things up.


#5

Hi

i just ran into the same thing. The odd part is that everything works fine if i make a new piston to test this. It is only happening in an existing piston and i cant figure out why. I will probably make just another if statement i guess and that should work, i was just curious if any of you knows the reason why it works in a new piston and not in the existing one. Also i am curious about the case statements as mentioned in the comments but a search will probably clarify that for me. :blush:


#6

I am seeing the same issue. Wonder if there is a bug.


#7

A new IF statement can be added anywhere you see:
+ add a new statement

If you do not see that, there is a chance your piston is corrupted.
Creating a new piston from scratch should resolve any corruption.


#8

I just ran into the same issue. Once I have added an ‘else if’, I can’t create or paste anything in it. Worst, it seems to corrupt the piston. If I duplicate it, I duplicate the corruption. I tried with a brand new piston and corrupted it as well…
I temporary solved the issue by having multiple ‘if’ but I would rather have a ‘if-else if-else’.


#9

Nesting works very well, if you are careful:

IF X is true
Then
    Do A (IF)
Else
    IF Y is true
    Then
        Do B (ELSE-IF... only Y is true)
    Else
        Do C (ELSE... both X & Y are false)
    END IF 
END IF

#10

I’m seeing this issue too this morning. I found if I cancel the current changes and then discard the local copy it starts to work again. I guess once it gets its knickers in a twist you’re best off not saving it.