Jump to content

And(..) Or(..) Parentheses


Chasewood

Recommended Posts

I can't figure out how to invoke this feature.

 

The And(..) button does not appear in the Program Content window unless there are two conditions under "If,"

 

When it appears, pressing the And(..) button puts an open paren on the next line after the two conditions and a close paren on the line after that.

 

The only way I can find to get anything between the parens is by using Move Line Up or Move Line Down, but that puts a bar at the front of the moved line and the program ignores it.

 

I have written a couple of programs using conditional statements without using these buttons and those programs are working fine. Unfortunately, I need to know how to make the parens work before I can go further.

 

I am on 4.0.5 - both firmware and UI.

Link to comment

There is no need for parens until the If becomes complex which is why there are no paren options for a single line If. The statements can be moved up or down and the parens can be moved up or down.

 

Post the Program that is not working with a description of what is not executing correctly.

Link to comment

By example

 

If
       (                               - this is a start parnethesis
            $iDay.of.Year < 365
        And $iLeap.Year > 0            - this and statment menas both statements must be true for the entire parenthesis group to be true
       )                              -  this is the end, so everything between these gets evaluated together as true/false
    Or (                               - this or statement means the true/false result of above group is "or'd" against the next item or group
            $iDay.of.Year < 366
        And $iLeap.Year is 0          -  this and statement means both statements must be true for the entire parenthesis section to be true
       )

Then
       $iDay.of.Year += 1
       $iDay.of.Year Init To $iDay.of.Year
       $sDay.of.Year Init To $iDay.of.Year
       $sDay.of.Year  = $iDay.of.Year
       Run Program 'Every x Day Counter' (Then Path)
       Run Program 'Year' (If)

Else
       $iDay.of.Year  = 1
       $iDay.of.Year Init To 1
       $sDay.of.Year  = $iDay.of.Year
       $sDay.of.Year Init To $iDay.of.Year
       Run Program 'Every x Day Counter' (Then Path)
       Run Program 'Year' (If)


 

Another much more complex example. Here we have nested parenthesis sections. You need to keep track of how far indented the parenthesis are as this controls what is nested inside of what.

 

If
       (
            $iDay.of.Month < 31
        And (
                 $iMonth is 1
              Or $iMonth is 3
              Or $iMonth is 5
              Or $iMonth is 7
              Or $iMonth is 8
              Or $iMonth is 10
              Or $iMonth is 12
            )
       )
    Or (
            $iDay.of.Month < 30
        And (
                 $iMonth is 4
              Or $iMonth is 6
              Or $iMonth is 9
              Or $iMonth is 11
            )
       )
    Or (
            $iDay.of.Month < 29
        And $iMonth is 2
        And $iLeap.Year is 0
       )
    Or (
            $iDay.of.Month < 28
        And $iMonth is 2
        And $iLeap.Year > 0
       )

Then
       $iDay.of.Month += 1
       $iDay.of.Month Init To $iDay.of.Month
       $sDay.of.Month Init To $iDay.of.Month
       $sDay.of.Month  = $iDay.of.Month
       Run Program 'Day of Week' (If)
       Run Program 'Month Advance' (If)
       Run Program 'Month Reset' (If)
       Run Program 'Week of Month' (Then Path)
       Run Program 'Ever X Weeks' (Then Path)
       Run Program 'Odd Even Day' (Then Path)
       Run Program 'Holiday reset' (Then Path)

Else
       $iDay.of.Month  = 1
       $iDay.of.Month Init To 1
       $sDay.of.Month Init To $iDay.of.Month
       $sDay.of.Month  = $iDay.of.Month
       Run Program 'Day of Week' (If)
       Run Program 'Month Advance' (If)
       Run Program 'Month Reset' (If)
       Run Program 'Week of Month' (Then Path)
       Run Program 'Ever X Weeks' (Then Path)
       Run Program 'Odd Even Day' (Then Path)
       Run Program 'Holiday reset' (Then Path)


Link to comment

It seems that some of my problem was caused by a 2476 not transmitting a signal when the pad is pressed. Does that mean the unit is faulty? It controls itself and seems to act OK as a responder.

 

I replaced it in my test program with a 2477 that sends a signal I can see on the event viewer.

 

The program now works, and so does the And(..), but the method I am using seems very clunky and as far as I can see is not documented. Do I have press the And button and then move statements into the parens? Intuitively it seems I should be able to enter them directly between the parens.

 

Should I be doing this differently?

 

Also, the example posted by apostolakis (as other examples in the Wiki) looks far cleaner that what I was seeing on my program content page when I first started. The open parens was preceded by a dash, the close was followed by a dash, and each line inside the parens was preceded by a vertical bar. All that was adding to my confusion, and it seems all that display clutter went away when I closed the AC and later reopened it.

 

Feels like I'm groping in the dark here, but finding my way forward slowly. Thanks for the help.

Link to comment

The program now works, and so does the And(..), but the method I am using seems very clunky and as far as I can see is not documented. Do I have press the And button and then move statements into the parens? Intuitively it seems I should be able to enter them directly between the parens.

 

 

Yes. Entering a set of parenthesis is done as a single click that enters both the start and finish. ISY always adds new content to the end, so you use "move line up" or "move line down" to get the start/finish around the right stuff. Or alternatively, you can move the conditions up or down to get them inside of the parenthesis.

 

I agree it does seem clunky, but it works fine and since it is not something you are likely going to do that often, a little clunkyness isn't the end of the world.

Link to comment

I agree that the display problems seem to be particular to my PC. We've just rebuilt the same test program on my wife's MAC / parallels and we see none of the display clutter there that appears on my system.

 

I wonder if the other display problem I have (See First Character Overwritten elsewhere in Q&A). Michel couldn't reproduce that problem so couldn't do anything to solve it, but the display corruption is still there.

 

Also, when creating new scenes or re-naming scenes the changes sometimes don't display in the Main / Network list when the changes are made, but if I close and reopen the AC, they appear by magic.

 

Maybe they're all related?

Link to comment

I tried upgrading Java again and this time it allowed me to install 7.0.21-b11.

I think there was a problem with even earlier releases hanging around that hindered the upgrade last time I tried.

Ah! the joys of being stuck on XP.

Anyway, Java 7 has cleared up the program display clutter (definitely) and the scene naming problems (probably) but not the initial character overwrite.

Progress indeed!

Link to comment
Also, the example posted by apostolakis (as other examples in the Wiki) looks far cleaner that what I was seeing on my program content page when I first started. The open parens was preceded by a dash, the close was followed by a dash, and each line inside the parens was preceded by a vertical bar. All that was adding to my confusion, and it seems all that display clutter went away when I closed the AC and later reopened it.

 

See these examples taken from my 4.0.5 Admin console:

 

 

 

The check box in the lower right enables/disables the lines. These are to help you visualize nested paren sections. I normally keep them off but have found the useful on a few occasions.

 

-Xathros

post-1437-140474159633_thumb.jpg

post-1437-140474159634_thumb.jpg

Link to comment

LeeG-

 

Consider it a small bit of compensation for the wealth of knowledge I have gained from you.

 

-Xath

Link to comment

We've resurrected our old XP laptop, updated the OS and Java on it and installed the ISY AC.

It works perfectly there and without the overwrite problems I have on my working system.

Looks like the issue is caused by something unique to the working system, although I am not aware of any similar symptoms in other applications.

I can live with that.

Link to comment
Guest
This topic is now closed to further replies.

×
×
  • Create New...