Jump to content

And(..) Or(..) Parentheses


Chasewood

Recommended Posts

Posted

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.

Posted

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.

Posted

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)


Posted

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.

Posted

I can understand all that clutter causing confusion as it should not be there and is not on my 4.0.5. What is the Java level as it sounds like a Java issue?

Posted

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.

Posted

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?

Posted

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!

Posted

We're in the process of updating the software on our old XP laptop. When that's done we'll install the AC and see if the problem character overwrite problem shows up on it.

Posted

It may be the installing a new OS fixes your problem, but in that case it would indicate a corrupted xp on that computer, not that xp itself is problematic. I have 8 computers running xp and all of them run the admin console just fine.

Posted
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

Posted

Thanks Xathros - I've not used that feature in the 4+ years of working with the ISY. Learn something new almost every day.

Posted

LeeG-

 

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

 

-Xath

Posted

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.

Guest
This topic is now closed to further replies.

  • Recently Browsing

    • No registered users viewing this page.
  • Forum Statistics

    • Total Topics
      37k
    • Total Posts
      371.5k
×
×
  • Create New...