ddeanwms Posted March 30 Posted March 30 I am used to writing SQL queries....this UD program is stumping me. I have an if then else program that I want to run every 30 minutes. How is that done in UD Programs? Quote
paulbates Posted March 30 Posted March 30 (edited) Add a Repeat statement as the first statement under then. One of the options is "Repeat Every" set that to 30 minutes. The statements under Repeat will indent Note that when the conditions of the If are no longer true, it will stop. In this program, it should bounce back and forth between then and else... which I think is your intent Edited March 30 by paulbates 1 Quote
ddeanwms Posted March 30 Author Posted March 30 On 3/30/2025 at 7:30 PM, paulbates said: Add a Repeat statement as the first statement under then. One of the options is "Repeat Every" set that to 30 minutes. The statements under Repeat will indent Note that when the conditions of the If are no longer true, it will stop. In this program, it should bounce back and forth between then and else... which I think is your intent Expand I did this before (every 10 minutes as a test) by adding to the THEN and ELSE statements....but when I looked in the SUMMARY TAB of the PROGRAMS TAB, and hit "refresh" I did not see the "Last finish time" or the "next Scheduled Run" had updated at all. Is this normal? Or should it have updated? Quote
ddeanwms Posted March 30 Author Posted March 30 What I really want is for the entire program to run once an hour. Quote
larryllix Posted March 30 Posted March 30 Also to be noted in ISY programming...Looping, of any kind, cannot be nested. Multiple programs must be used for nested looping.Sent from my SM-S711W using Tapatalk Quote
Solution paulbates Posted March 30 Solution Posted March 30 (edited) On 3/30/2025 at 8:02 PM, ddeanwms said: What I really want is for the entire program to run once an hour. Expand Ok, you'll need 2 programs <Program 1> Computer Cabinet once an hour If <no statement> Then Repeat every 1 hour Run If Program Computer cabinet <Program 2> Computer Cabinet <your current program> Notes: Set the first program to run on start up Disable program 2 so it does not run automatically What this will do is the the ISY will run program 1 when its started Program 1 will run once an hour Program one will call program 2 Program 2 is disabled so it will only run when program 1 calls it Edited March 30 by paulbates 3 Quote
apostolakisl Posted Thursday at 06:41 PM Posted Thursday at 06:41 PM (edited) I would only add that the first time you need to manually run the first program. "run then". Since it is set to run at startup, any reboots will automatically get it going. As an alternative, you can install the time data node. Using that, you can have it run at a specific schedule rather than on a loop starting whenever the program first ran. In this case, no need to run at startup. Below is an example to run at the top and bottom of the hour, every hour. If 'TimeData' Minute is 0 minute Or 'TimeData' Minute is 30 minute Then Run Program '2' (If) Else - No Actions - (To add one, press 'Action') Edited Thursday at 06:58 PM by apostolakisl 1 Quote
dbwarner5 Posted Friday at 02:51 PM Posted Friday at 02:51 PM On 4/3/2025 at 6:41 PM, apostolakisl said: I would only add that the first time you need to manually run the first program. "run then". Since it is set to run at startup, any reboots will automatically get it going. As an alternative, you can install the time data node. Using that, you can have it run at a specific schedule rather than on a loop starting whenever the program first ran. In this case, no need to run at startup. Below is an example to run at the top and bottom of the hour, every hour. If 'TimeData' Minute is 0 minute Or 'TimeData' Minute is 30 minute Then Run Program '2' (If) Else - No Actions - (To add one, press 'Action') Expand I prefer to do both... have program one run at startup and then I also set multiple times in the if to ensure that program 2 is running. If Time is: 8am or 12pm or 5pm or 12 am etc... Then Run program 2 then. Quote
larryllix Posted Friday at 03:05 PM Posted Friday at 03:05 PM On 4/4/2025 at 2:51 PM, dbwarner5 said: I prefer to do both... have program one run at startup and then I also set multiple times in the if to ensure that program 2 is running. If Time is: 8am or 12pm or 5pm or 12 am etc... Then Run program 2 then. Expand I also do that however it was never established what the logic is for [Run at Startup] is. I know it will fail with a time trigger because it appears to act like an AND function with the other IF logic making it nonfunctional. A few programs I have included a line Run ThisProgram[then] into the Else section to ensure it actually functions. Quote
apostolakisl Posted Saturday at 03:29 AM Posted Saturday at 03:29 AM On 4/4/2025 at 3:05 PM, larryllix said: I also do that however it was never established what the logic is for [Run at Startup] is. I know it will fail with a time trigger because it appears to act like an AND function with the other IF logic making it nonfunctional. A few programs I have included a line Run ThisProgram[then] into the Else section to ensure it actually functions. Expand Blank if will run true at startup if set to run at startup. Quote
apostolakisl Posted Saturday at 03:34 AM Posted Saturday at 03:34 AM On 4/4/2025 at 2:51 PM, dbwarner5 said: I prefer to do both... have program one run at startup and then I also set multiple times in the if to ensure that program 2 is running. If Time is: 8am or 12pm or 5pm or 12 am etc... Then Run program 2 then. Expand This program will be false at startup (if set to run at startup). setting it to run at startup wont accomplish anything unless you intend to run the else clause. Quote
dbwarner5 Posted Saturday at 03:41 PM Posted Saturday at 03:41 PM On 4/5/2025 at 3:34 AM, apostolakisl said: This program will be false at startup (if set to run at startup). setting it to run at startup wont accomplish anything unless you intend to run the else clause. Expand Oops.. typo.. meant to say that program 2 is set to run at startup. And program 1 runs at multiple times of the day to ensure prog 2 is actually running. 1 Quote
larryllix Posted Sunday at 01:16 PM Posted Sunday at 01:16 PM (edited) On 4/5/2025 at 3:29 AM, apostolakisl said: Blank if will run true at startup if set to run at startup. Expand I prefer not to add another dummy program just to run another a startup and try to use the function without another program. I have a few with Else sections that just jump back to the Then sections. Run at Startup would be much better as another program line that users could be aware that it exists without extra documentation, inside the program. A coding line for Run at Startup would also disclose the logic Run at Startup uses, and be controllable by the user usage of AND or OR logic. No extra confusing program or hidden checkbox would be necessary. Programs should be self-contained, not logic spread all over the webpages and jumps into the middle of other programs in spaghetti bowl style programming. Edited Sunday at 01:17 PM by larryllix 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.